gufo.err.cli¶
err
utility.
Cli
¶
Bases: object
err
utility class.
__check_dir(path)
staticmethod
¶
col(t, width)
staticmethod
¶
get_handler(name)
¶
Get handler for command.
Return the handler for furher command processing.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Command name |
required |
Returns:
Type | Description |
---|---|
Callable[[Namespace], ExitCode]
|
Callable, accepting argparse.Namespace |
Callable[[Namespace], ExitCode]
|
and returning ExitCode. |
get_index(prefix)
staticmethod
¶
Get fingerprint index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prefix |
str
|
Error Info directory prefix |
required |
Returns:
Type | Description |
---|---|
Dict[str, str]
|
Dict of fingerprint -> file name |
handle_clear(ns)
¶
Clear selected errors.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ns |
Namespace
|
argsparse.Namespace with fields:
|
required |
Returns:
Type | Description |
---|---|
ExitCode
|
Exit code. |
handle_list(ns)
¶
Show the list of the registered errors.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ns |
Namespace
|
argsparse.Namespace with fields:
|
required |
Returns:
Type | Description |
---|---|
ExitCode
|
Exit code. |
handle_version(_ns)
¶
Print Gufo Err version.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
_ns |
Namespace
|
Options namespace, ignored. |
required |
Returns:
Type | Description |
---|---|
ExitCode
|
Exit code. |
handle_view(ns)
¶
Show the details of the selected errors.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ns |
Namespace
|
argsparse.Namespace with fields:
|
required |
Returns:
Type | Description |
---|---|
ExitCode
|
Exit code. |
iter_fingerprints(items, prefix)
staticmethod
¶
Resolve fingerprint expressions and iterate result.
Fingerprint expressions is a list user-defined expressions passed via command line. Each item may be:
<UUID>
- single fingerprintall
or*
- all errors
Parameters:
Name | Type | Description | Default |
---|---|---|---|
items |
List[str]
|
List of expressions. |
required |
prefix |
str
|
Error info directory |
required |
Returns:
Type | Description |
---|---|
Iterable[str]
|
Yields all resolved fingerprints. |
rcol(t, width)
staticmethod
¶
read_info(path)
staticmethod
¶
run(args)
¶
Main dispatcher function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
args |
List[str]
|
List of command-line arguments. |
required |
ExitCode
¶
Bases: IntEnum
Cli exit codes.
Attributes:
Name | Type | Description |
---|---|---|
OK |
Successful exit |
|
NOT_EXISTS |
Error Info directory is not found |
|
EACCESS |
Error Info directory is not readable |
|
CANNOT_READ |
Cannot read Error Info file |
|
INVALID_ARGS |
Invalid arguments |
|
SYNTAX |
Invalid expression |
ListItem
dataclass
¶
Bases: object
Data structure for err list
.
Attributes:
Name | Type | Description |
---|---|---|
fingerprint |
str
|
Stringified fingerprint. |
exception |
str
|
Exception string. |
name |
str
|
Application name. |
ts |
datetime
|
Error timestamp. |
place |
str
|
Error location. |
main()
¶
Run err utility with command-line arguments.