onyo.lib.command_utils module
- onyo.lib.command_utils.allowed_config_args(git_config_args)[source]
Check a list of arguments for disallowed
git configflags.git-configstores configuration information in a variety of locations. This makes sure that such location flags aren’t in the list (and--help).A helper for the
onyo configcommand.- Parameters:
git_config_args (
list[str]) – The list of arguments to pass togit config.- Raises:
ValueError – If a disallowed flag is detected.
- Return type:
bool
- onyo.lib.command_utils.get_history_cmd(interactive, repo)[source]
Get the command to display history.
The command is selected according to the (non)interactive mode, and
whichverifies that it exists.A helper for the
onyo historycommand.- Parameters:
interactive (
bool) – Whether the CLI mode is interactive or not.repo (
OnyoRepo) – The OnyoRepo to search through for the configuration.
- Raises:
ValueError – If the configuration key is either not set or the configured history program cannot be found by
which.- Return type:
str
- onyo.lib.command_utils.natural_sort(assets, keys)[source]
Sort an asset list by a list of
keys.- Parameters:
assets (
list[dict|UserDict]) – Assets to sort.keys (
dict[str,Literal['ascending','descending']]) – Keys to sortassetsby.reverse – Whether to sort in reverse order.
- Return type:
list[dict|UserDict]