Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here

PathPicker

PathPicker accepts a wide range of input -- output from git commands, grep results, searches -- pretty much anything.After parsing the input, PathPicker presents you with a nice UI to select which files you're interested in. After that you can open them in your favorite editor or execute arbitrary commands.

Subscribe to updates I use PathPicker


Statistics on PathPicker

Number of watchers on Github 3706
Number of open issues 2
Average time to close an issue 9 days
Main language Python
Average time to merge a PR 1 day
Open pull requests 3+
Closed pull requests 11+
Last commit over 1 year ago
Repo Created over 4 years ago
Repo Last Updated over 1 year ago
Size 1.09 MB
Homepage http://facebook.g...
Organization / Authorfacebook
Latest Release0.7.2
Contributors36
Page Updated
Do you use PathPicker? Leave a review!
View open issues (2)
View PathPicker activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating PathPicker for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

PathPicker

Build Status

Facebook PathPicker is a simple command line tool that solves the perpetual problem of selecting files out of bash output. PathPicker will:

  • Parse all incoming lines for entries that look like files
  • Present the piped input in a convenient selector UI
  • Allow you to either:
    • Edit the selected files in your favorite $EDITOR
    • Execute an arbitrary command with them

It is easiest to understand by watching a simple demo:

Examples

After installing PathPicker, using it is as easy as piping into fpp. It takes a wide variety of input -- try it with all the options below:

  • git status | fpp
  • hg status | fpp
  • git grep "FooBar" | fpp
  • grep -r "FooBar" . | fpp
  • git diff HEAD~1 --stat | fpp
  • find . -iname "*.js" | fpp
  • arc inlines | fpp

and anything else you can dream up!

Requirements

PathPicker requires Python >2.6 or >3.0.

Supported Shells:

  • Bash is fully supported and works the best.
  • ZSH is supported as well but won't have a few features like alias expansion in command line mode.
  • csh/fish/rc are supported in the latest version, but might have quirks or issues in older versions of PathPicker. Note however if your default shell and current shell is not in the same family (bash/zsh... v.s. fish/rc), you need to manually export environment variable $SHELL to your current shell.

Installing PathPicker

Homebrew

Installing PathPicker is easiest with Homebrew for mac:

  • brew update (to pull down the recipe since it is new)
  • brew install fpp

Linux

On debian systems, installation can be done by installing the debian package from here. To build the package locally, run these steps:

$ git clone https://github.com/facebook/PathPicker.git
$ cd debian
$ ./package.sh 
$ ls ../fpp_0.7.2_noarch.deb

On Arch Linux, PathPicker can be installed from Arch User Repository (AUR). the AUR fpp-git package.

If you are on another system, or prefer manual installation, please follow the instructions given below.

Manual Installation

However if you're on a system without Homebrew, it's still quite easy to install PathPicker since it's essentially just a bash script that calls some Python. These steps more-or-less outline the process:

  • cd /usr/local/ # or wherever you install apps
  • git clone https://github.com/facebook/PathPicker.git
  • cd PathPicker/

Here we make a symbolic link from the bash script in the repo to /usr/local/bin/ which is assumed to be in the current $PATH

  • ln -s "$(pwd)/fpp" /usr/local/bin/fpp
  • fpp --help # should work!

Add-ons

For tmux users, you can additionally install tmux-fpp which adds a key combination to run PathPicker on the last received stdout. It makes jumping into file selection mode even easier -- check it out here.

Advanced Functionality

As mentioned above, PathPicker allows you to also execute arbitrary commands with the specified files. Here is an example showing a git checkout command executed against the selected files:

The selected files are appended to the command prefix to form the final command. If you need the files in the middle of your command, you can use the $F token instead, like:

cat $F | wc -l

Another important note is that PathPicker by default only selects files that exist on the filesystem. If you want to skip this (perhaps to selected deleted files in git status), just run PathPicker with the --no-file-checks flag.

How PathPicker works

PathPicker is a combination of a bash script and some small Python modules. It essentially has three steps:

  • First in the bash script, it redirects all standard out in to a python module that parses and extracts out filename candidates. Each candidate is then checked against the actual filesystem to ensure it exists; after that, we save the data in a temporary file and the python script exits.
  • Next, the bash script switches to terminal input mode and another python module reads out the saved entries and presents them in a selector UI built with curses. The user either selects a few files to edit or inputs a command to execute.
  • Lastly, the python script outputs a command to a bash file that is later executed by the original bash script.

It's not the most elegant architecture in the world but (in our opinion) provides a lot of utility.

Documentation & Configuration

For all documentation and configuration options, see the output of fpp --help.

Join the PathPicker community

See the CONTRIBUTING file for how to help out.

License

PathPicker is BSD-licensed. We also provide an additional patent grant.

PathPicker open issues Ask a question     (View All Issues)
  • about 3 years Allow making non-interactive the default
  • about 4 years makeManpage errors out on FreeBSD 10.1 with xmllint
  • about 4 years release tarballs
PathPicker open pull requests (View All Pulls)
  • added test case for describe file feature
  • Refine support for `csh`, `fish` and `rc` shells (fix #41).
  • Allow preconfigured commands through custom key bindings
PathPicker questions on Stackoverflow (View All Questions)
  • Facebook PathPicker does not work with ZSH
PathPicker list of languages used
PathPicker latest release notes
0.7.2 0.7.2 support -- new year, new FPP!

Highlights from git log 0.7.1..HEAD

  • Finally support for vim splitting with the correct line numbers from @brwong
  • Add support for disabling the slash in front of filenames with home (a vestigial hack from internal Facebook infra)
  • Some nice font fixes for better readability
  • Better support for csh, fish, and rc shells from @weakish

Thanks everyone for the support

0.7.1 0.7.1: more shortcut support and even more matching!

Highlights from git log 0.7.0..HEAD

  • Support for the Home, End, Page Up, and Page Down keys from @robertbachmann (PR #228 #229)
  • Fix command mode for the fish shell (PR #227)
  • Matches even .DS_STORE (PR #223)
  • Some small edits like removing unused imports, cleaning up Debian package, and a bug that would sometimes hang the UI.

As always, big thanks to the community for their support and contributions!

0.7.0 0.7.0 Stability and AllInput mode

Another awesome community release!

  • @gsheld added an all input mode in #210 which allows you to use fpp to work with non-file inputs like git branches or mercurial bookmarks. Helpful for when you just want to use the selector UI and don't have another fuzzy selector installed.
  • Improves zsh and csh support. Special thanks to @benmccormick
  • Adds support for filenames with commas and spaces and parens (in any combinatino)
  • emacsclient line jump support
Other projects in Python