Skip to content

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build status Slack Room

Choices

Configurable multiline choice selector with a prompt.

Install

With fisherman

fisher choices

Usage

choices --prompt="Which profile should I erase? " \
        --error="The only profiles I know are: %(choices)" \
        --literal 1 "Mike" "Dave" "Bruce"
Mike
Dave
Bruce
Which profile should I erase? Wade
The only profiles I know are: Mike Dave Bruce

Selection by item index.

choices --prompt="Which library do you want to install? Default: All" \
        --default=6 \
        "Node" "Ruby" "Python" "Groovy" "Clojure" "All of the above"
1) Node
2) Ruby
3) Python
4) Groovy
5) Clojure
6) All of the above
Which library do you want to install? Default: All # Press Enter
=> 6

Options

-p, --prompt: The message prompted to the user requesting the input. String. Default: "Select one : "

-e, --error: The message displayed to the user when the selection is not valid. String. Default: "Invalid selection. Must be one of %(choices)!"

-l --literal: Switches between selection by index or explicitly by one of the literal choices sent, by default the selection is done by it's index. Boolean defaults to 0

-d, --default: The default value if the user just presses enter without any value. String. Default: None.

-h, --help: Show usage information.

About

Configurable multiline choice selector with a prompt

Resources

Stars

16 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages