Arguments and Flags
Arguments and flags can be used to provide information beyond a command name.
Arguments
Command Argument Properties describes the properties available for specifying command arguments.
Name | Description |
---|---|
name | The name of the argument. |
type | The value type. Valid values are boolean , string , and int . |
description | A description of the argument, used as the help message for the command in the CLI. |
mandatory | When set to true , the argument must always be supplied. |
defaultValue | (Optional) The value used if none is specified. |
The following shows the definition of an argument used in a hypothetical mtxctl export 100
command:
command:
name: export
description: Export some data
arguments:
- name: numberOfRecords
type: int
mandatory: true
description: The number of records to export
Flags
Flags are similar to arguments but can be passed in any order. They typically have a small finite set of valid values. Command Flag Properties describes the properties available for specifying command flags.
Property | Description |
---|---|
name | The name of the flag. |
shortName | A shorter name of the flag, typically a single character. |
type | The value type. Valid values are boolean , string , and int . |
description | A description of the flag, used as the help message for the command in the CLI. |
mandatory | When set to true , the flag must always be supplied. |
defaultValue | (Optional) The value used if none is specified by the user. |
The following shows the definition of two flags used in a hypothetical mtxctl export -e 1 --subdomain 1
command:
command:
name: export
description: Export some data
flags:
- name: engine
shortName: e
type: int
mandatory: false
defaultValue: 1
description: The Engine id
- name: subdomain
shortName: s
type: int
mandatory: false
defaultValue: 1
description: The Subscriber Domain id
A flag is more appropriate than an argument for some Boolean values. For example, a flag can be used to enable some functionality that is disabled by default.