rename Confit's add_args to set_args

This commit is contained in:
Adrian Sampson 2012-12-20 17:14:04 -08:00
parent 2f5165d4e1
commit 3c511b9e27
3 changed files with 9 additions and 7 deletions

View file

@ -638,7 +638,7 @@ def _raw_main(args, load_config=True):
# Parse the command-line!
options, subcommand, suboptions, subargs = parser.parse_args(args)
config.add_args(options)
config.set_args(options)
# Open library file.
dbpath = config['library'].as_filename()

View file

@ -685,7 +685,7 @@ import_cmd.parser.add_option('-i', '--incremental', dest='incremental',
import_cmd.parser.add_option('-I', '--noincremental', dest='incremental',
action='store_false', help='do not skip already-imported directories')
def import_func(lib, opts, args):
config['import'].add_args(opts)
config['import'].set_args(opts)
# Special case: --copy flag suppresses import_move (which would
# otherwise take precedence).

View file

@ -140,14 +140,16 @@ class ConfigView(object):
return value
def add(self, value):
"""Add a value as a source for configuration data. The object as
added as the lowest-priority source. This can be used to
dynamically extend the defaults.
"""Set the *default* value for this configuration view. The
specified value is added as the lowest-priority configuration
data source.
"""
raise NotImplementedError
def set(self, value):
"""Create an overlay source to set the value at this view.
"""*Override* the value for this configuration view. The
specified value is added as the highest-priority configuration
data source.
"""
raise NotImplementedError
@ -164,7 +166,7 @@ class ConfigView(object):
"""
self.set({key: value})
def add_args(self, namespace):
def set_args(self, namespace):
"""Overlay parsed command-line arguments, generated by a library
like argparse or optparse, onto this view's value.
"""