[Buildroot] [PATCH v5 02/11] autobuild-run: use docopt for argument parsing
Thomas De Schampheleire
patrickdepinguin at gmail.com
Fri Feb 6 11:13:51 UTC 2015
On Thu, Feb 5, 2015 at 11:52 PM, Thomas Petazzoni
<thomas.petazzoni at free-electrons.com> wrote:
> Dear Thomas De Schampheleire,
> On Fri, 12 Dec 2014 21:04:47 +0100, Thomas De Schampheleire wrote:
>> From: Thomas De Schampheleire <thomas.de.schampheleire at gmail.com>
>> Using docopt, argument parsing becomes trivial. Adding a new argument is
>> a matter of updating the usage text.
>> This commit removes the original cumbersome argument handling and uses
>> docopt instead. A method is added to import the settings from the
>> configuration file in a similar dictionary as the one created by docopt,
>> so that both can be merged (giving priority to the configuration file,
>> as before).
> Actually, in the current implementation, priority is given to the
> command line option, and not the configuration file. Like most Unix
> tools, I believe.
> So to make your implementation behave like the existing one, I believe
> I just need to change:
>> + if args['--config']:
>> + ini_config = load_ini_config(args['--config'])
>> + # merge config/args, priority given to config
>> + args = merge(ini_config, args)
> # merge config/args, priority given to args
> args = merge(args, ini_config)
Yes, that should be it.
I had indeed misinterpreted the original code priority.
More information about the buildroot