idmtools.entities.command_line module¶
Defines the CommandLine class that represents our remote command line to be executed.
Copyright 2021, Bill & Melinda Gates Foundation. All rights reserved.
- class idmtools.entities.command_line.CommandLine(executable=None, *args, is_windows: bool = False, raw_args: List[Any] | None = None, **kwargs)[source]¶
Bases:
object
A class to construct command-line strings from executable, options, and params.
- __init__(executable=None, *args, is_windows: bool = False, raw_args: List[Any] | None = None, **kwargs)[source]¶
Initialize CommandLine.
- Parameters:
executable – Executable
*args – Additional Arguments
is_windows – is the command for windows
raw_args – Any raw arguments
**kwargs – Keyword arguments
- add_raw_argument(arg)[source]¶
Add an argument that won’t be quote on format.
- Parameters:
arg – arg
- Returns:
None
- add_option(option, value)[source]¶
Add a command-line option.
- Parameters:
option – Option to add
value – Value of option
- Returns:
None
- property options¶
Options as a string.
- Returns:
Options string
- property arguments¶
The CommandLine arguments.
- Returns:
Arguments as string
- property raw_arguments¶
Raw arguments(arguments not to be parsed).
- Returns:
Raw arguments as a string
- property cmd¶
Converts command to string.
- Returns:
Command as string
- static from_string(command: str, as_raw_args: bool = False) CommandLine [source]¶
Creates a command line object from string.
- Parameters:
command – Command
as_raw_args – When set to true, arguments will preserve the quoting provided
- Returns:
CommandLine object from string