Add debug option back

This commit is contained in:
jpic 2020-02-15 19:47:24 +01:00
parent c84353c126
commit 5c38dc13b0
3 changed files with 16 additions and 1 deletions

View File

@ -14,6 +14,16 @@ class Action:
r'([^ =]+)=': '{blue}\\1{red}={reset} ',
r'=': '{blue}={reset} ',
}
options = dict(
debug=dict(
alias='d',
default='visit',
help='''
Display debug output. Supports values (combinable): cmd,out,visit
'''.strip(),
immediate=True,
),
)
def __init__(self, *args, **kwargs):
self.args = args

View File

@ -121,6 +121,10 @@ class ConsoleScript(cli2.ConsoleScript):
self[name] = cli2.Callable(
name,
action.callable(),
options={
k: cli2.Option(name=k, **v)
for k, v in action.options.items()
},
color=getattr(action, 'color', cli2.YELLOW),
)
return super().__call__(*args, **kwargs)

View File

@ -53,6 +53,7 @@ class Output:
).encode('utf8'))
if flush:
if not line.endswith('\n'):
self.write(b'\n')
self.flush()