Package: apt Severity: wishlist Usertags: push
Patch to add support for clearing configuration items from the command-line: $ apt-config -o Foo::Bar=1 -o "#clear Foo::Bar" dump | grep ^Foo Foo ""; Foo::Bar "";
=== modified file 'apt-pkg/contrib/cmndline.cc' --- apt-pkg/contrib/cmndline.cc 2011-09-21 16:42:08 +0000 +++ apt-pkg/contrib/cmndline.cc 2012-01-22 08:49:03 +0000 @@ -192,6 +192,24 @@ // Arbitrary item specification if ((A->Flags & ArbItem) == ArbItem) { + // Specials + if (strlen(Argument) >= 1 && Argument[0] == '#') + { + const char *I = strchrnul(Argument, ' '); + const string Dir(Argument+1,I); + + if (Dir == "clear") + { + if (*I != ' ' || *(I+1) == 0) + return _error->Error(_("Syntax error %s:%u: clear directive requires an option tree as argument"),"",0); + Conf->Clear(string(I+1)); + } + else + return _error->Error(_("Syntax error %s:%u: Unsupported directive '%s'"),"",0,Dir.c_str()); + + return true; + } + const char *J = strchr(Argument, '='); if (J == NULL) return _error->Error(_("Option %s: Configuration item specification must have an =<val>."),argv[I]);