cmdr::ask - Cmdr - Terminal-based simple user interactions
Welcome to the Cmdr project, written by Andreas Kupries.
For availability please read Cmdr - How To Get The Sources.
This package provides a few utility commands implementing a few simple terminal-based interactions with the user.
When invoked this command prompts the user with query for a string. If the default is specified and not the empty string it is also shown as part of the prompt. Note that default defaults to the empty string.
The interactively entered string is returned as the result of the command. The default is returned as the result if the user entered an empty string and the default is not empty.
The prompt to show to the user before interaction begins.
The default to return if the user enters nothing.
This command is similar to ::cmdr::ask string, except it allows for more customization of the interaction through options.
The accepted options are
The prompt to show to the user before interaction begins.
Behaves like ::cmdr::ask string without a default, except that the user's input is not echoed back to the terminal. This command is for the entry of hidden strings, i.e. passwords, and the like.
The prompt to show to the user before interaction begins.
When invoked this command prompts the user with query for a boolean value/string. If the default is specified and not the empty string it is also shown as part of the prompt. Note that default defaults to the empty string.
The interactively entered boolean is returned as the result of the command. The default boolean is returned as the result if the user entered an empty string and the default is not empty.
Note that the command will not return until the user entered a valid boolean value. Entering a non-boolean string causes the command to loop internally and re-prompt.
The prompt to show to the user before interaction begins.
The default boolean to return if the user enters nothing.
When invoked this command prompts the user with query for one of the choices, entered as string. Prompt and input happen on a single line.
The interactively entered choice is returned as the result of the command. The default choice is returned as the result if the user entered an empty string and the default is not empty.
Note that the command will not return until the user entered a valid choice. Entering a non-choice causes the command to loop internally and re-prompt. The user is supported in entry by an internal completion callback.
The prompt to show to the user before interaction begins.
The default boolean to return if the user enters nothing.
Similar to ::cmdr::ask choose, except that the choices are shown as an enumerated menu, one per line, with a leading header. Furthermore the command accepts not only the choices as input, but also their numeric indices in the menu. The result however is always the relevant chosen string.
Both the package(s) and this documentation will undoubtedly contain bugs and other problems. Please report such at Cmdr Tickets.
Please also report any ideas you may have for enhancements of either package(s) and/or documentation.
arguments, command hierarchy, command line completion, command line handling, command tree, editing command line, help for command line, hierarchy of commands, interactive command shell, optional arguments, options, parameters, processing command line, tree of commands
Copyright © 2013-2016 Andreas Kupries
Copyright © 2013-2016 Documentation, Andreas Kupries