Bug#656844: apt: support #clear directive in CommandLine parser
On 23 January 2012 21:07, David Kalnischkies
<kalnischkies+debian@gmail.com> wrote:
> Hi!
>
> On Sun, Jan 22, 2012 at 10:02, Daniel Hartwig <mandyke@gmail.com> wrote:
>> 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
>
> Thanks for the patch!
>
> But i am not sure if this is a good idea. Adding it this way means that the
> commandline -o looks more like it would support the same syntax as a
> configuration file does, but differences exist:
> Statements do (not) end with a semicolon, scope-usage is (dis)allowed,
> the syntax to set an option is (not) config::option=value, …
A fine point.
I did consider ignoring a trailing semicolon on this patch but decided
it was a bad idea as, really, the semicolon is used in the conf. files
as a statement separator and I did not want to hint at (nor implement)
support for multiple statements in -o.
By extending -o, client programs would automatically inherit the
support. Not that I am aware of any programs using CommandLine right
now except APT so that's a bit of a non-argument ;-)
What about a more distinct syntax? I'd suggest the obvious "-o
-APT::Get", but "-" is valid in option names, '#' is very suggestive
of comment syntax, and there aren't really many characters left that
suggest "clear this option"...
> Also a -c for including additional configfiles exist, but if we support #clear
> in -o we should properly add #include, too…
Only left that out as apt.conf(5) mentions #include being deprecated.
>
> All in all i think a --clear(-option) option would be better.
> What do you think?
I didn't even consider this, though it is a reasonable option :-) I
presume this would be supported by extending CommandLine::AFlag?
--
Daniel Hartwig
Reply to: