Pick
Pick is a command line tool for selecting from multiple options. It takes items on standard input or from a file, and interactively prompts you to choose one or more of them.
Installation
gem install pick
Examples
# select a file
ls | pick
# edit a file under the current directory tree
vim $(find . -type f | pick)
# edit multiple files under the current directory tree
vim $(find . -type f | pick -m)
# check out a branch interactively
git branch -a | pick | xargs git checkout
# delete a file, safe even when filenames contain newlines
find . -type f -print0 | pick -0 | xargs -0 rm -v
# delete many files
find . -type f -print0 | pick -0 -m | xargs -0 rm -v
# choose a color from colors.txt
pick colors.txt
Development
After checking out the repo, run bundle install
to install dependencies. Then, run rake test
to run the tests. You can use pry -r ./lib/pick
to get an interactive shell.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/ab/pick/.
License
The gem is available as open source under the terms of the GPL v3.