#
Argument
Specify positional arguments (required or optional) used by your script.
args:
- name: user
help: AWS Username.
required: true
- name: role
help: User role.
default: admin
allowed:
- admin
- guest
- name: key
help: Path to SSH key.
validate: file_exists
The argument's value will be available to you as ${args[name]}
in your bash
function.
Note
Most properties are optional, unless specified otherwise.
#
Basic Options
#
name
String Required
The name of the argument. Use lowercase letters, since it serves multiple purposes:
- It will be capitalized in the help text.
- It will be used as the hash key in the
${args[...]}
associative bash array.
#
help
String
The message to display when using --help
. Can have multiple lines.
#
Common Options
#
default
String / Array of Strings
The value to use in case it is not provided by the user. Implies that this argument is optional.
When using repeatable
#
required
Boolean
Specify that this argument is required.
Note
Once you define an optional argument (without required: true
) then you cannot
define required arguments after it.
#
Advanced Options
#
allowed
Array of Strings
Limit the allowed values to a specified whitelist. Can be used in conjunction
with default
required
#
repeatable
Boolean
Specify that this argument can be provided multiple times.
The received value will be formatted as a quoted, space-delimited string which
you will need to convert to array with something like
eval "data=(${args[path]})"
.
#
unique
Boolean
Specify that the values for this repeatable
argument must be unique.
Non-unique values will be ignored.
#
validate
String
Apply a custom validation function.