cli
Tools for constructing a nice CLI.
PathToDir
Bases: Action
Checks a paths point to an existing directory.
Source code in src/orsm/cli/cli.py
95 96 97 98 99 100 101 102 103 104 | |
PathToFile
Bases: Action
Checks a paths point to an existing file.
Source code in src/orsm/cli/cli.py
83 84 85 86 87 88 89 90 91 92 | |
setup_standard_parser(*argparse_args, **argparse_kwargs)
Sets up a standard argument parser.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
argparse_args |
Positional combinations passed to the parser. |
()
|
|
argparse_kwargs |
Keyword combinations passed to the parser. |
{}
|
Returns:
| Type | Description |
|---|---|
argparse.ArgumentParser :
|
An argument parser. |
Source code in src/orsm/cli/cli.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
standard_parse(*argparse_args, **argparse_kwargs)
Perform a standard parse.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
argparse_args |
Positional combinations passed to the parser. |
()
|
|
argparse_kwargs |
Keyword combinations passed to the parser. |
{}
|
Returns:
| Type | Description |
|---|---|
argparse.Namespace :
|
The namespace generated from the standard parse. |
Source code in src/orsm/cli/cli.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
unit_test_parse(*argparse_args, **argparse_kwargs)
Parse command line ahead of forwarding onto the unittests.
Notes
To allow our command line combinations to be parsed ahead of running unit tests. Useful for logging. Taken from: https://stackoverflow.com/a/44248445/5134817
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
argparse_args |
Positional combinations passed to the parser. |
()
|
|
argparse_kwargs |
Keyword combinations passed to the parser. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
|
Source code in src/orsm/cli/cli.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |