#620: Add --debug

This commit is contained in:
Vladimir Iakovlev
2017-03-28 13:09:11 +02:00
parent d47ff8cbf2
commit c3eca8234a
4 changed files with 32 additions and 12 deletions
+4
View File
@@ -24,6 +24,10 @@ class Parser(object):
'-y', '--yes',
action='store_true',
help='execute fixed command without confirmation')
self._parser.add_argument(
'-d', '--debug',
action='store_true',
help='enable debug output')
self._parser.add_argument('command',
nargs='*',
help='command that should be fixed')
+8 -3
View File
@@ -113,10 +113,15 @@ class Settings(dict):
def _settings_from_args(self, args):
"""Loads settings from args."""
if args and args.yes:
return {'require_confirmation': False}
else:
if not args:
return {}
from_args = {}
if args.yes:
from_args['require_confirmation'] = not args.yes
if args.debug:
from_args['debug'] = args.debug
return from_args
settings = Settings(const.DEFAULT_SETTINGS)