mirror of
https://github.com/beetbox/beets.git
synced 2026-01-06 07:53:40 +01:00
merge latest confit
This commit is contained in:
parent
ac8109bb5f
commit
56a2d41183
1 changed files with 10 additions and 11 deletions
|
|
@ -151,6 +151,16 @@ class ConfigView(object):
|
|||
"""
|
||||
self.overlay[key] = value
|
||||
|
||||
def add_args(self, namespace):
|
||||
"""Add parsed command-line arguments, generated by a library
|
||||
like argparse or optparse, to this view's overlay.
|
||||
"""
|
||||
args = {}
|
||||
for key, value in namespace.__dict__.items():
|
||||
if value is not None: # Avoid unset options.
|
||||
args[key] = value
|
||||
self.overlay.update(args)
|
||||
|
||||
# Magical conversions. These special methods make it possible to use
|
||||
# View objects somewhat transparently in certain circumstances. For
|
||||
# example, rather than using ``view.get(bool)``, it's possible to
|
||||
|
|
@ -482,17 +492,6 @@ class Configuration(RootView):
|
|||
for filename in self._filenames():
|
||||
self.sources.append(load_yaml(filename))
|
||||
|
||||
def add_args(self, namespace):
|
||||
"""Add parsed command-line arguments, generated by a library
|
||||
like argparse or optparse, as an overlay to the configuration
|
||||
sources.
|
||||
"""
|
||||
arg_source = {}
|
||||
for key, value in namespace.__dict__.items():
|
||||
if value is not None: # Avoid unset options.
|
||||
arg_source[key] = value
|
||||
self.sources.insert(0, arg_source)
|
||||
|
||||
def config_dir(self):
|
||||
"""Get the path to the directory containing the highest-priority
|
||||
user configuration. If no user configuration is present, create a
|
||||
|
|
|
|||
Loading…
Reference in a new issue