mozilla/configman — pull request #71 by twobraids (2013-03-08 14:28:33+00:00)
Title: added named arguments

This change to configman adds named arguments.

$ some_app.py --help
usage:
some_app.py [OPTIONS]... arg1 [ arg2 [ arg3 ]]

It's the arg1, arg2, arg3 that I'm interested in here. Normally, you'd access these with sys.args without configman or config.args with configman. They come to the programmer as an uninterpreted list of strings. I'm treating them just like switches. The end result to the programmer looks like this:

config = config_manager.get_config()
print config.arg1, config.arg2, config.arg3

In other words, from the programmers perspective, they're just values passed into the program with the same access method and priority as command line switches. In fact, the configman Option object is used to specify both switches and arguments:

n.add_option(
name='filename',
doc='the name of the file',
default=None,
is_argument=True
)

see http://www.twobraids.com/2013/03/named-arguments-for-configman.html for more details