mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-25 17:45:55 +02:00
App: Support --verbose
Add the --verbose global option, which is made available as the App.verbose property. Some functions still take a verbose parameter, but the type of these parameters is converted from bool to bool|None. The idea is that, if they are None, their verbosity falls back to the global default. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
525fa34387
commit
67a2931f5e
5 changed files with 28 additions and 11 deletions
|
|
@ -31,14 +31,18 @@ def pretty_cmd(cmd: list[str], wd=None):
|
|||
ret += f' in {wd}'
|
||||
return ret
|
||||
|
||||
# See ec.Local.run() for what this function does
|
||||
async def run_cmd(*args, ec: ExecContext|None=None, **kwargs) -> tuple[str|bytes|None, str|bytes|None]:
|
||||
# See ExecContext.run() for what this function does
|
||||
async def run_cmd(*args, ec: ExecContext|None=None, verbose: bool|None=None, **kwargs) -> tuple[str|bytes|None, str|bytes|None]:
|
||||
if verbose is None:
|
||||
verbose = False if ec is None else ec.verbose_default
|
||||
if ec is None:
|
||||
from .ec.Local import Local
|
||||
ec = Local()
|
||||
return await ec.run(*args, **kwargs)
|
||||
ec = Local(verbose_default=verbose)
|
||||
return await ec.run(verbose=verbose, *args, **kwargs)
|
||||
|
||||
async def run_curl(args: list[str], parse_json: bool=True, wd=None, throw=None, verbose=False, cmd_input=None, ec: ExecContext|None=None) -> dict|str: # export
|
||||
async def run_curl(args: list[str], parse_json: bool=True, wd=None, throw=None, verbose=None, cmd_input=None, ec: ExecContext|None=None) -> dict|str: # export
|
||||
if verbose is None:
|
||||
verbose = False if ec is None else ec.verbose_default
|
||||
cmd = ['curl']
|
||||
if not verbose:
|
||||
cmd.append('-s')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue