Bash Prompts
Supported methods
The following Prompts are supported by the Bash SDK:
- checkbox
- confirm
- datetime
- editor
- input
- list
- number
- password
- secret
Note: Every prompt has -f
/ --flag
options that can be used to set the corresponding daemon command line flag accordingly.
Checkbox
Checkbox presents a list of options to the user, who can select multiple items in the interface (i.e. terminal or slack).
USAGE:
cto-ai prompt checkbox <CHOICES>... [OPTIONS] --message <MESSAGE> --name <NAME>
ARGS:
<CHOICES>... List of choices to be loaded in the list. Example: val1 val2 OR 'Val 1' 'Val 2'
OPTIONS:
-d, --default <DEFAULT VALUE>... Sets default selected value/values in the list
-m, --message <MESSAGE> Message to be displayed to the user
-n, --name <NAME> Name of the checkbox prompt
Example:
response=cto-ai prompt checkbox 'javascript' 'golang' 'rust' --message='What are your favourite languages?' --name='language'
echo $response
Output:
golang
Confirm
Confirm presents a yes/no question to the user in the interface (i.e. terminal or slack).
USAGE:
cto-ai prompt confirm [FLAGS] --message <MESSAGE> --name <NAME>
FLAGS:
-F, --default-false Sets false as the default value for confirm
-T, --default-true Sets true as the default value for confirm
OPTIONS:
-m, --message <MESSAGE> Message to be displayed to the user
-n, --name <NAME> Name of the confirm prompt
Example:
response=cto-ai prompt confirm --message='Continue?' --name='continue'
echo $response
Output:
true
Datetime
Datetime presents a date picker to the user that allows them to select a date and/or time in the interface. (i.e. terminal or slack).
USAGE:
cto-ai prompt datetime [FLAGS] [OPTIONS] --message <MESSAGE> --name <NAME>
FLAGS:
-D, --date Only get a date, with no associated time
-h, --help Prints help information
-t, --time Only get a time, with no associated date
-V, --version Prints version information
OPTIONS:
-d, --default <DEFAULT VALUE> Sets default value for datetime. Formats: '2019-12-11T21:37:12-08:00' or '2019-12-11T13:39:37Z'
--max <MAX> Sets maximum value for datetime. Formats: '2019-12-11T21:37:12-08:00' or '2019-12-11T13:39:37Z'
-m, --message <MESSAGE> Message to be displayed to the user
--min <MIN> Sets minimum value for datetime. Formats: '2019-12-11T21:37:12-08:00' or '2019-12-11T13:39:37Z'
-n, --name <NAME> Name of the datetime prompt
Example:
response=cto-ai prompt datetime --message='Pick a date' --name='date' --min='2020-01-01T00:00:00-08:00'
echo $response
Output:
2020-03-01T12:00:00-08:00
Editor
Editor presets a prompt requesting a multi-line response from the user. If used in a terminal interface, the nano editor will be presented.
USAGE:
cto-ai prompt editor [OPTIONS] --message <MESSAGE> --name <NAME>
OPTIONS:
-d, --default <DEFAULT> Sets initial value in the editor
-m, --message <MESSAGE> Message to be displayed to the user
-n, --name <NAME> Name of the editor prompt
Example:
response=cto-ai prompt confirm --message='Please add a commit message' --name='commit'
echo $response
Output:
[text entered in a terminal window]
Input
Input presents an input (single-line text) prompt in the interface (i.e. terminal or slack).
The method returns the user's response as string.
USAGE:
cto-ai prompt input [FLAGS] [OPTIONS] --message <MESSAGE> --name <NAME>
FLAGS:
-a, --allow empty Allows the user to submit an empty value
OPTIONS:
-d, --default <DEFAULT> Sets a default response
-m, --message <MESSAGE> Message to be displayed to the user
-n, --name <NAME> Name of the input prompt
Example:
response=cto-ai prompt input --message='What is your favourite colour?' --name='colour'
echo $response
Output:
blue
List
List presents a list of options to the user to select one item from in the interface (i.e. terminal or Slack).
USAGE:
cto-ai prompt list <CHOICES>... [OPTIONS] --default <DEFAULT> --message <MESSAGE> --name <NAME>
ARGS:
<CHOICES>... The choices to include in the list
OPTIONS:
-d, --default <DEFAULT> Sets a default response
-m, --message <MESSAGE> Message to be displayed to the user
-n, --name <NAME> Name of the input prompt
Example:
response=cto-ai prompt list 'javascript' 'golang' 'rust' --message='What is your favourite language?' --name='language'
echo $response
Output:
golang
Number
Number presents a prompt for a numeric value in the interface (i.e. terminal or Slack).
USAGE:
cto-ai prompt number [OPTIONS] --message <MESSAGE> --name <NAME>
OPTIONS:
-d, --default <DEFAULT VALUE> Default value for the number prompt
--max <MAX> The maximum acceptable value for the prompt (inclusive)
-m, --message <MESSAGE> Message to be displayed to the user
--min <MIN> The minimum acceptable value for the prompt (inclusive)
-n, --name <NAME> Name of the number prompt
Example:
response=cto-ai prompt number --message='What is your favourite number?' --name='number'
echo $response
Output:
3
Password
Password presents an input prompt for passwords in the interface (i.e. terminal or Slack).
The password can be entered by the user or selected from their team's secret store. If the value is entered directly, it will be obscured on the screen.
For passwords, the name
doubles as the default secret store key for the desired secret. If this key is present, it will be selected as the default option for the user.
The method returns the user's response as string.
USAGE:
cto-ai prompt password [FLAGS] [OPTIONS] --message <MESSAGE> --name <NAME>
FLAGS:
--confirm Asks for password confirmation.
OPTIONS:
-m, --message <MESSAGE> Message to be displayed to the user
-n, --name <NAME> Name of the password prompt. Used as a key to match the secret store [aliases: key]
Example:
response=cto-ai prompt password --message='Password' --name='login'
echo $response
Output:
*****
Secret
Secret presents an input prompt for secrets in the interface (i.e. terminal or Slack).
The secret can be entered by the user or selected from their team's secret store. The value will be displayed on the terminal/screen as it is entered for verification.
For secrets, the name
doubles as the default secret store key for the desired secret. If this key is present, it will be selected as the default option for the user.
The method returns the user's response as string.
USAGE:
cto-ai prompt secret [OPTIONS] --message <MESSAGE> --name <NAME>
OPTIONS:
-m, --message <MESSAGE> Message to be displayed to the user
-n, --name <NAME> Name of the secret prompt. Used as a key to match the secret store [aliases: key]
Example:
response=cto-ai prompt secret --message='AWS secret id' --name='aws_secret'
echo $response
Output:
5jfjieDJ4jiJIWC56
🚀 What's next?
- If you want to explore the options offered by our SDKs, go to the Bash SDK page.
- To learn more about the UX options available for you, please go to Bash UX page.
- Add Secrets Management page to the Password and Secrets prompts.