4 from naja.constants import DEFAULTS
8 '''A dict with attribute access'''
9 def __getattr__(self, attr):
18 Parse arguments and store them in the options dictionary.
20 Note: If you add arguments, you need to add an appropriate default to the
23 options.update(DEFAULTS)
25 options.debug = 'DEBUG' in os.environ
27 parser = optparse.OptionParser()
28 parser.add_option('--no-sound',
29 dest='sound', action='store_false', default=True,
30 help='Disable all sound, including music')
32 parser.add_option('--no-music',
33 dest='music', action='store_false', default=True,
34 help='Disable music (but not sound)')
36 opts, _ = parser.parse_args(args)
39 if getattr(opts, k, None) is not None:
40 options[k] = getattr(opts, k)