Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gko/listbox
💬 listbox element for bash
https://github.com/gko/listbox
bash bashrc list listbox listbox-element zsh zshrc
Last synced: 3 months ago
JSON representation
💬 listbox element for bash
- Host: GitHub
- URL: https://github.com/gko/listbox
- Owner: gko
- License: mit
- Created: 2016-12-26T20:40:02.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2022-06-15T17:55:39.000Z (over 2 years ago)
- Last Synced: 2024-06-23T04:55:50.381Z (7 months ago)
- Topics: bash, bashrc, list, listbox, listbox-element, zsh, zshrc
- Language: Shell
- Size: 29.3 KB
- Stars: 46
- Watchers: 4
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Listbox
💬 listbox element for bash
![demo](https://github.com/gko/listbox/raw/master/demo.gif)
Simple bash listbox to choose from options
## Installation
### Manually
```bash
git clone https://github.com/gko/listbox
```then in .bashrc or .zshrc:
```bash
source ./listbox/listbox.sh
```### With [Fig](https://fig.io)
Fig adds apps, shortcuts, and autocomplete to your existing terminal.
Install `listbox` in just one click.
### With [antigen](https://github.com/zsh-users/antigen)
In your .zshrc
```sh
antigen bundle gko/listbox
```### With [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh)
```sh
git clone https://github.com/gko/listbox.git ~/.oh-my-zsh/custom/plugins/listbox```
then in your .zshrc
```bash
plugins=(
...
listbox
...
)
```## Usage
```bash
Usage: listbox [options]
Example:
listbox -t title -o "option 1|option 2|option 3" -r resultVariable -a '>'
Options:
-h, --help help
-t, --title list title
-o, --options "option 1|option 2" listbox options
-r, --result result variable
-a, --arrow selected option symbol
```### General usage
```bash
source ./listbox.sh
listbox -t Title -o "option 1|option 2|option 3" -r result
echo "user chose: $result"
```output:
```bash
Title
-----
option 1
> option 2
option 3
user chose: option 2
```### Specify arrow symbol
```bash
listbox -t Title -o "option 1|option 2|option 3" -a '→'
```output:
```bash
Title
---
→ option 1
option 2
option 3
option 1
```### Pipe directly to variable
```bash
result=$(listbox -t Title -o "option 1|option 2|option 3" | tee /dev/tty | tail -n 1)
echo "user chose: $result"
```output:
```bash
Title
---
option 1
> option 2
option 3
user chose: option 2
```## Like it?
:star: this repo
## License
[MIT](http://opensource.org/licenses/MIT)
Copyright (c) 2012-2016 Konstantin Gorodinskiy