lib: More result log beautification
This commit adds more tweaks to shell command output in order to make it nicer. The biggest patch is in Result.__summarize(), which makes it more versatile, and allows removal of some code in SSHClient.
App sees some independent, minor result format beautification.
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
869bef2c06
commit
82caacaaf8
3 changed files with 59 additions and 37 deletions
|
|
@ -9,9 +9,9 @@ from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace
|
|||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from .AsyncRunner import AsyncRunner
|
||||
from .log import DEBUG, ERR, NOTICE, log, set_log_flags, set_log_level
|
||||
from .util import pretty_cmd
|
||||
from .log import DEBUG, ERR, NOTICE, log, log_m, set_log_flags, set_log_level
|
||||
from .Types import LoadTypes
|
||||
from .util import pretty_cmd
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Awaitable
|
||||
|
|
@ -177,7 +177,8 @@ class App: # export
|
|||
try:
|
||||
# Import argcomplete only here to not require it to be compatible
|
||||
# with minimal environments
|
||||
from argcomplete.completers import BaseCompleter # type: ignore[import-not-found]
|
||||
from argcomplete.completers import \
|
||||
BaseCompleter # type: ignore[import-not-found]
|
||||
|
||||
class NoopCompleter(BaseCompleter):
|
||||
|
||||
|
|
@ -208,7 +209,7 @@ class App: # export
|
|||
if isinstance(ret, int) and ret >= 0 and ret <= 0xFF:
|
||||
exit_status = ret
|
||||
except Exception as e:
|
||||
log(ERR, 'Failed: {}'.format(repr(e) if self.__back_trace else str(e)))
|
||||
log_m(ERR, 'Failed: {}'.format(repr(e) if self.__back_trace else str(e)))
|
||||
exit_status = 1
|
||||
# AssertionErrors are programming errors, hence a programmer should
|
||||
# get a chance to figure it out
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue