shell_utils package¶
Submodules¶
shell_utils.cli module¶
Usage: [OPTIONS] COMMAND [ARGS]…
A cli for shell-utils.
- Options:
--help Show this message and exit.
shell_utils.shell_utils module¶
Main module.
-
shell_utils.shell_utils.
cd
(path_: Union[os.PathLike, str])[source]¶ Change the current working directory.
-
shell_utils.shell_utils.
env
(**kwargs) → Iterator[os._Environ][source]¶ Set environment variables and yield new environment dict.
-
shell_utils.shell_utils.
path
(*paths, prepend=False, expand_user=True) → Iterator[List[str]][source]¶ Add the paths to $PATH and yield the new $PATH as a list.
Parameters: - prepend – prepend paths to $PATH else append
- expand_user – expands home if ~ is used in path strings
-
shell_utils.shell_utils.
quiet
()[source]¶ Suppress stdout and stderr.
https://stackoverflow.com/questions/11130156/suppress-stdout-stderr-print-from-python-functions
-
shell_utils.shell_utils.
shell
(command: str, check=True, capture=False) → subprocess.CompletedProcess[source]¶ Run the command in a shell.
!!! Make sure you trust the input to this command !!!
Parameters: - command – the command to be run
- check – raise exception if return code not zero
- capture –
if set to True, captures stdout and stderr, making them available as stdout and stderr attributes on the returned CompletedProcess.
This also means the command’s stdout and stderr won’t be piped to FD 1 and 2 by default
Returns: Completed Process
Module contents¶
Top-level package for shell-utils.