Interactive checkboxes (menu) with pagination and vim keybinds for bash
- Features
- Quick Start
- Promotion
- Arguments Usage
- How to use with another script
- Keybinds Usage
- Limitations
- Select only a option or multiple options
- Select or unselect multiple options easily
- Select all or unselect all
- Pagination
- Optional Vim keybinds
- A .sh file with approximately 500 lines
- Start with options selected
- Show selected options counter for multiple options
- Show custom message
- Show current option index and options amount
- Copy current option value to clipboard
- Help tab when press h or wrongly call the script
Run the script (in bash shell) with source checkbox.sh
⭐ If you like this software, give a star ⭐
📖 Contributions are welcome 📖
Use the argument --options=""
You can add new options:
- With the character
|
- With new line
- Mixed
To start with options selected, put +
before the option text (in first character)
- If the argument --multiple is missing, just the first option marked with + will start selected
Any of this ASCII signs \a \b \f \n \r \t
in any part of options will be removed.
If --options"" is missing. Sample options will be loaded with 30 options.
Use the argument --message=""
You can customize message
-
Using ANSI
Example:--message="\033[2K\033[31mhello world"
-
Using ASCII
\a \b \e \f \n \r \t \v
Example:--message="hello\rworld"
-
Maybe the layout breaks, in this case, try to refresh (press
r
)
Use the argument --multiple
Use the argument --index
You can get the script response in the variable $checkbox_output after execute the script
- Example:
#!/usr/bin/env bash
source checkbox.sh --multiple --index
clear
selected_options="$checkbox_output"
echo "$selected_options"
- Other example: https://github.com/pedro-hs/git-selection
Press [UP ARROW]
or 'k'
to move cursor to option above
Press [UP DOWN]
or 'j'
to move cursor to option below
Press [PAGE UP]
or 'd'
to move cursor 5 options above
Press [PAGE DOWN]
or 'u'
to move cursor 5 options below
Press [HOME]
or 'g'
to move cursor to first option
Press [END]
or 'G'
to move cursor to last option
Press [SPACE]
or x
Press [ENTER]
or 'o'
Press 'c'
or 'y'
Press 'a'
to select all and 'A'
to unselect all
Press 'v'
to turn on/off select mode 'V'
to turn on/off unselect mode
-
If select mode is on. Cursor will be green and when you move up or down the options will be selected
-
If unselect mode is on. Cursor will be red and when you move up or down the options will be unselected
Press 'r'
to refresh renderization
Press 'h'
or call script with invalid argument, and a help page will appear
- Doesn't have a good compatibility with mac, I will work on this in future
- Uses bash array, so bash or similars are needed to run this script
- Terminal must have at least 8 lines for the script works. Maybe breaks in some cases with --message too. Resize terminal and press 'r'
- Don't have unit test