proj_flow.base.cmd

The proj_flow.base.cmd defines environment for proj_flow.api.env.Runtime.

proj_flow.base.cmd.which(cmd: str) str | None

Return executable path from PATH environment variable, if it is present.

Parameters:

cmd – name of the tool to expand

Returns:

the path to an executable which would be run if the given cmd was called. If no cmd would be called, return None.

proj_flow.base.cmd.is_tool(name: str) bool
Parameters:

name – name of the tool to check

Returns:

True, if which() would return a string and False otherwise

proj_flow.base.cmd.run(app: str, *args: str, capture_output=False)

Run command with arguments and return a subprocess.CompletedProcess instance. Internally, this function runs subprocess.run() with encoding set to “UTF-8” and check turned off.

Parameters:
  • app – name of the command to run

  • args – additional arguments of the command

  • capture_output – if True, both stdout and stderr are captured

Returns:

The CompletedProcess instance if the command was successfully ran, or None.

proj_flow.base.cmd.cd(path: str)