node-selector
Turn arbitrary commands into selectable lists
Example: instantly create a branch switcher alias
$ alias 'switch-branch'='git checkout `sel git branch`'$ switch-branch coffeescript * master purescript test Which line do you want to select? 3Switched to branch 'purescript'
Installation
Via npm:
npm install -g cli-selector
Usage
Exec mode (default): -e | --exec
# sel --exec <command to execute> cd `sel ls` LICENSE README.md index.js node_modules package.json Which line do you want to select?
JSON mode: -j | --json
Select from an array of 2-tuples. The first value in each tuple will be treated as the value and the second will be treated as a comment. Useful for cryptic values.
# sel --json '<JSON Array: [[value1, comment1], [value2, comment2], ...]>' $ sel --json '[["8.8.8.8", "Staging"], ["123.123.123.123", "Production"]]' 8.8.8.8 ## Staging 123.123.123.123 ## Production Which line do you want to select?
List mode: -l | --list
Select from a space separated list of values.
# sel --list <space separated values> $ sel --list one two three one two three Which line do you want to select?