Represents a CLI argument that is configured from a dictionary. For example, the "top level" arguments used for the CLI (--region, --output) can use a CustomArgument argument, as these are described in the cli.json file as dictionaries. This class is also useful for plugins/cu
| 190 | |
| 191 | |
| 192 | class CustomArgument(BaseCLIArgument): |
| 193 | """ |
| 194 | Represents a CLI argument that is configured from a dictionary. |
| 195 | |
| 196 | For example, the "top level" arguments used for the CLI |
| 197 | (--region, --output) can use a CustomArgument argument, |
| 198 | as these are described in the cli.json file as dictionaries. |
| 199 | |
| 200 | This class is also useful for plugins/customizations that want to |
| 201 | add additional args. |
| 202 | |
| 203 | """ |
| 204 | |
| 205 | def __init__( |
| 206 | self, |
| 207 | name, |
| 208 | help_text='', |
| 209 | dest=None, |
| 210 | default=None, |
| 211 | action=None, |
| 212 | required=None, |
| 213 | choices=None, |
| 214 | nargs=None, |
| 215 | cli_type_name=None, |
| 216 | group_name=None, |
| 217 | positional_arg=False, |
| 218 | no_paramfile=False, |
| 219 | argument_model=None, |
| 220 | synopsis='', |
| 221 | const=None, |
| 222 | ): |
| 223 | self._name = name |
| 224 | self._help = help_text |
| 225 | self._dest = dest |
| 226 | self._default = default |
| 227 | self._action = action |
| 228 | self._required = required |
| 229 | self._nargs = nargs |
| 230 | self._const = const |
| 231 | self._cli_type_name = cli_type_name |
| 232 | self._group_name = group_name |
| 233 | self._positional_arg = positional_arg |
| 234 | if choices is None: |
| 235 | choices = [] |
| 236 | self._choices = choices |
| 237 | self._synopsis = synopsis |
| 238 | |
| 239 | # These are public attributes that are ok to access from external |
| 240 | # objects. |
| 241 | self.no_paramfile = no_paramfile |
| 242 | self.argument_model = None |
| 243 | |
| 244 | if argument_model is None: |
| 245 | argument_model = self._create_scalar_argument_model() |
| 246 | self.argument_model = argument_model |
| 247 | |
| 248 | # If the top level element is a list then set nargs to |
| 249 | # accept multiple values seperated by a space. |
no outgoing calls