For accepting input, if stdin is a tty then prompt rather than forcing the user to specify a flag. Never require a prompt though. The user needs to be able to automate the CLI in a script so allow them to override prompts always.
Before executing the command, display what it looks like, to help the users learn how to use the CLI without the prompt.
E.g (the command following the interactive prompt shown below, huge thanks to Amy, working on MAAS UX for the awesome prototype)
$ maas deploy machine-name os=ubuntu release=18.04
Interactive prompts
Question objects containing question related values.
-
defaults: (String | Number | Boolean | Array | Function)
Default value(s) are used when nothing is entered or the function returns the default value(s). -
validate: (Function) Should returntrueif the value is valid, and an error message (String) otherwise. Iffalseis returned, a default error message is provided.
Prompt type
-
list
Questions with a list of items for a user to select will contain thequestionandchoiceswith optionaldefaultproperties.
Optional enhancement: autocomplete - presents a list of option as the user types and display the nearest neighbours in the list as they type.
When a user typed the wrong argument, the prompt can suggest the nearest neighbour based on the input string.
-
input
When the prompt requires a user to add input in a certain format, it will contain thequestionand receivesinputwith optionaldefaultorvalidateproperties.
Some input format might require validation before proceeding such as datetime input, number input, etc.
For instance, the input prompt that requires a number input might need to validate that an input is a valid number before submitting. If an input is not a number, it will print an error message.

-
confirm
When a prompt is asking for ayesornoanswer, it is recommended to have adefaultanswer as part of the question, even though default is an optional choice.
For instance
> Register MAAS as KVM host [default = no] : (y/N)
Reference:
The prototype in this example uses inquirerJS to prototype the interactive prompts.
