[spambayes-dev] proposal for more uniform option setting from the
command line
T. Alexander Popiel
popiel at wolfskeep.com
Wed Nov 12 13:53:30 EST 2003
In message: <16306.30305.187928.62359 at montanaro.dyndns.org>
Skip Montanaro <skip at pobox.com> writes:
>
>How about instead of only allowing specific options to be overridden on the
>command line we use a consistent syntax for overriding *any* option from the
>command line?
+1
>The general syntax of an option setting command line arg would then be
>section:field:value. The post-getopt.getopt() code might look something
>like:
>
> from spambayes.Options import options
>
> for opt, arg in opts:
> ...
> elif opt in ('-o', '--option'):
> options.set(*arg.split(':'))
> ...
Only problem here is that this particular phrasing makes it impossible
to set an option value with a colon in it. Better would be to use
options.set(*arg.split(':', 2)).
>We would then deprecate any command line args used to twiddle options using
>any other syntax. Use of those args would trigger a message to stderr like:
>
> Deprecated form: "-d ~/hammie.db" found.
> Use "-o Storage:persistent_storage_file:~/hammie.db" instead.
+1
>This could be extended further. Should the user give an incomplete -o flag
>such as "-o Storage" or "-o Storage:spam_cache", help about that section or
>variable could be emitted:
I would tend to put this in a separate syntax, and have an incomplete
specification just emit an error message (possibly saying something like
'use --help=Storage for more information').
- Alex
More information about the spambayes-dev
mailing list