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.

Overview

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: 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-based systems, run these steps: fakeroot:

$ git clone https://github.com/facebook/PathPicker.git
$ cd PathPicker/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

If you are 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 create 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. This 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 using 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 (or -nfc, for short) flag.

How PathPicker works

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

  • Firstly, the bash script redirects all standards out into a python module that parses and extracts out filename candidates. These candidates are extracted with a series of regular expressions, since the input to PathPicker can be any stdout from another program. Rather than make specialized parsers for each program, we treat everything as noisy input, and select candidates via regexes. To limit the number of calls to the filesystem (to check existence), we are fairly restrictive on the candidates we extract.

The downside to this is that files that are single words, with no extension (like test), that are not prepended by a directory will fail to match. This is a known limitation to PathPicker, and means that it will sometimes fail to find valid files in the input.

  • Next, a selector UI built with curses is presented to the user. At this point you can select a few files to edit, or input 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, it 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.md file for how to help out.

License

PathPicker is MIT licensed.

License: MIT

Comments
  • Created a script for automatic creation of .deb packages from source Resolve #43

    Created a script for automatic creation of .deb packages from source Resolve #43

    As mentioned by @pcottle , I have made the necessary additions to makeDist.py and created all necessary files in debian directory which would facilitate the creation of the debian package. Please review.

    I have already accepted Facebook's Contributor License Agreement (CLA).

    CLA Signed 
    opened by pallavagarwal07 30
  • Linux packages

    Linux packages

    It would be good to have Linux packages available, at least .deb and .rpm versions. I don't know anyone that uses Linuxbrew, it doesn't seem ideal on Linux when better solutions exist.

    The HHVM team distribute Linux packages, you could probably see how they do it.

    help wanted 
    opened by Daniel15 29
  • Doesn't work when login shell is csh

    Doesn't work when login shell is csh

    Darwin wkoszek-macbook.local 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64

    My login shell is CSH. To rule out CSH, I've run Bash in iTerm2 window and tested too. Same problem. I tested in Vagrant with ubuntu/trusty64. Stuff works OK there, so what I describe below seems to be MacOSX specific.

    I did:

    brew update brew install fpp.

    cd /tmp mkdir sample cd sample cal 2010 > 2010 cal 2011 > 2011 cal 2012 > 2012

    /bin/ls -1 ./* | fpp

    I select 2010, press f, select 2011, press f, press c, type 'cat', . Nothing happens. I'm dropped to fpp subshell. I'd expect to see output from cat'ed files.

    ---------------- cat ~/.fpp/.fpp.sh ---------------------- if type shopt > /dev/null; then shopt -s expand_aliases fi

    echo "executing command:" echo "cat './2010' './2011'"

    cat './2010' './2011'

    So selection part works OK. Execution is doing something wrong.

    I started to add some debugging code: https://github.com/wkoszek/PathPicker/

    opened by wkoszek 25
  • ANSI color support

    ANSI color support

    ~~This is a shitty first pass at colors that I hacked together because I couldn't sleep.~~ Now better!

    Turns out ncurses doesn't really support (AFAIK, someone please correct me...) setting foreground/background color combinations directly, so I cache and create color_pair as I go along. Most terms have at least 32 and mine on OSX seems to have 256.

    I'm also totally not a python developer, so the code here is probably quite not idomatic.

    Screencap because I don't know how to do that cool video thing: the command was git diff --color | fpp screen shot 2015-05-08 at 3 30 50 am

    Things to improve on

    • Make the chrome use colors instead of hardcoding color_pair(0).
    CLA Signed 
    opened by lastquestion 16
  • Allow specifying command as an argument to fpp

    Allow specifying command as an argument to fpp

    Would this be possible? Something like:

    git status | fpp -c 'git add'

    So that the default action is overridden and I can just hit 'enter' after selecting files to run git add on them.

    enhancement pcottle-ASAP 
    opened by xatnys 15
  • Allow preconfigured commands through custom key bindings

    Allow preconfigured commands through custom key bindings

    For use cases where PP is used frequently with the same command, it's quite annoying to have to always type the same command (eg. rspec for Ruby testing).

    This PR allows the user to associate custom commands that can be executed through specified keys (eg. r for rspec), speeding up the PP workflow for repetitive command executions.

    Custom bindings/commands are stored in the <FPP_DIR>/.fpp.keys (in the [bindings] group) as standard text configuration file. The existing clean FPP internal interface allows such configuration functionality to be trivially extended, for example, in case FPP will implement a static configuration.

    This implementation is the simplest possible; notably, it doesn't support keys already bound (which would significantly complicate the feature).

    Due to the test framework, it's not easy to write an end-to-end test - in fact, the existing functionality for executing command hasn't this type of tests; therefore, the test have been updated to inspect the visualization of the custom keys/commands.

    CLA Signed 
    opened by 64kramsystem 14
  • PathPicker pollutes user home directory

    PathPicker pollutes user home directory

    PathPicker creates multiple files in the user home directory:

    $ ls .fb*
    .fbPager.log  .fbPager.pickle  .fbPager.selection.pickle  .fbPager.sh
    

    Normally such files are stored under $HOME/.local/share or $HOME/.config directory on Linux. Please see XDG Base Directory Specification for details.

    opened by vitaut 14
  • ImportError: No module named builtins

    ImportError: No module named builtins

    I just installed fpp using brew install fpp. When I try to run it, this is the output:

    Traceback (most recent call last):
      File "/usr/local/Cellar/fpp/0.8.2/libexec/src/processInput.py", line 12, in <module>
        import format
      File "/usr/local/Cellar/fpp/0.8.2/libexec/src/format.py", line 13, in <module>
        from formattedText import FormattedText
      File "/usr/local/Cellar/fpp/0.8.2/libexec/src/formattedText.py", line 9, in <module>
        from colorPrinter import ColorPrinter
      File "/usr/local/Cellar/fpp/0.8.2/libexec/src/colorPrinter.py", line 7, in <module>
        import output
      File "/usr/local/Cellar/fpp/0.8.2/libexec/src/output.py", line 8, in <module>
        from builtins import str
    ImportError: No module named builtins
    

    Am I missing anything?

    opened by friederbluemle 12
  • added test case for describe file feature

    added test case for describe file feature

    is there a better way to add a change to a PR that was already merged and closed?

    anyways, here's a passing test case, let me know if that's not what you were looking for 😄

    CLA Signed awaiting-reply 
    opened by rjdean123 12
  • Add executed command to shell history

    Add executed command to shell history

    It would be helpful if the executed command would be [optionally] added to the shell history.

    If one needs to repeat the command executed by PP, the workflow is very slow compared to just typing Up arrow and Enter, especially when a custom command is used.

    opened by 64kramsystem 12
  • Breaks when not in toplevel Git directory

    Breaks when not in toplevel Git directory

    git status | fpp, selecting files, and applying them to git add works fine when I'm at the top level of a Git repo, but not if I enter a subdirectory. It appears to append the selected file to the git repo path, not pwd.

    awaiting-reply 
    opened by hobzcalvin 12
  • feature request: open files in vim tab pages

    feature request: open files in vim tab pages

    Right now I achieve this using something like

    ls | fpp -c "vim -p"
    

    Could you give a environment variable other than FPP_DISABLE_SPLIT that uses vim -p instead of vim -O? Thank you so much!

    opened by kkew3 0
  • Release 0.9.5 but fpp --version says 0.9.2

    Release 0.9.5 but fpp --version says 0.9.2

    FYI, it looks like a version bump was forgotten for the 0.9.5 release, e.g.

    $ fpp --version
    fpp version 0.9.2
    

    This is because:

    https://github.com/facebook/PathPicker/blob/3670d02dbcb9ff232b1c8cbeb5468657dd582cf5/src/version.py#L6

    opened by HenrikBengtsson 1
  • Infinite loop when selecting entry with certain width relative to window width

    Infinite loop when selecting entry with certain width relative to window width

    Entries which end close to window border PathPicker cause infinite loop after trying to select them with either f or F.

    Following for loop is affected: https://github.com/facebook/PathPicker/blob/cc032b2b2fa2fa8ab2fedc93766b2bf2303781d2/src/pathpicker/screen_control.py#L668-L673

    Seemingly due to reaching this code path: https://github.com/facebook/PathPicker/blob/cc032b2b2fa2fa8ab2fedc93766b2bf2303781d2/src/pathpicker/line_format.py#L300-L306

    Which apparently keeps adding dirty indexes forever: https://github.com/facebook/PathPicker/blob/cc032b2b2fa2fa8ab2fedc93766b2bf2303781d2/src/pathpicker/line_format.py#L237-L238

    opened by jpalus 1
  • Standalone Executable File

    Standalone Executable File

    Please support bundling PathPicker into a single bundled executable file, so that distribution of the command/program does not need to include raw source directories.

    opened by ampersandy 0
  • Support for git diffs

    Support for git diffs

    In git diffs, there are sometimes lines that look like this:

    index f80b65d..c8f438a 100644
    --- a/tests/test_signature_parsing.py
    +++ b/tests/test_signature_parsing.py
    @@ -317,7 +317,7 @@ def expects_int(x: int) -> int:
    

    fpp picks up on the path a/tests/test_signature_parsing.py, but that path has a prefix a/ that is not desired (i.e. tests/test_signature_parsing.py would be prefered).

    I wonder: what is the best way for me (as a user) to handle this use-case? I.e. I would like to perform some processing of the selected path(s), e.g. using sed, before passing the paths to a command or opening with an editor.

    opened by Jasha10 0
Releases(0.9.5)
  • 0.9.5(Feb 14, 2022)

  • 0.9.2(Aug 30, 2019)

  • 0.8.2(Aug 8, 2019)

  • 0.7.2(Jan 3, 2017)

    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

    Source code(tar.gz)
    Source code(zip)
    fpp.0.7.2.tar.gz(26.72 KB)
  • 0.7.1(Apr 16, 2016)

    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!

    Source code(tar.gz)
    Source code(zip)
    fpp.0.7.1.tar.gz(147.00 KB)
  • 0.7.0(Nov 27, 2015)

    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
    Source code(tar.gz)
    Source code(zip)
    fpp.0.7.0.tar.gz(144.00 KB)
  • 0.6.2(Sep 29, 2015)

    This is mostly a community release actually! Fixed a new issues and bugs, notably:

    • @slackorama Fixed the bash exiting error for zsh in #191
    • @slackorama also fixed #192 which was an out-of-range index error
    • @alecjacobson fixed #187 which passed the -i flag only if we are not in the vim shell (so you can use FP from within vim!)
    • Few minor fixes like #182, #181
    • Expanded line support from @pallavagarwal07 in #178
    • @Shenil fixed makefile detection in #173
    • and a number of other great fixes!
    Source code(tar.gz)
    Source code(zip)
    fpp.0.6.2.tar.gz(141.00 KB)
  • 0.6.1(Jun 8, 2015)

    Fixed a number of small but important issues and introduced a few new features:

    -- #145 #149 Expand the types of files we can parse now that we have filesystem validation -- including hyphens, spaces, etc -- #137 X mode! Select files with letters rather than UI, thanks @xavierbeynon -- #143 Jump to line in sublime text, thanks @dufferzafar -- #138 Use interactive shell to run script, which should fix zsh sourcing issues, thanks @hlian

    Source code(tar.gz)
    Source code(zip)
    fpp.0.6.1.tar.gz(139.50 KB)
    fpp.deb(33.98 KB)
  • 0.6.0(May 22, 2015)

    Huge list of updates, the biggest though being filesystem validation which enables us to expand our regexes and match on many more files. Full list:

    • #135 / #118 -- long file truncation if it doesnt fit in the screen
    • #132 allow +'s in filenames for objective c
    • #128 and #127 fix some line printing bugs
    • #117 Debian packages!
    • #114 filesystem validation
    • FPP is now version aware (prints out its own version)
    Source code(tar.gz)
    Source code(zip)
    fpp.0.6.0.tar.gz(132.50 KB)
    fpp.deb(62.65 KB)
  • 0.5.7(May 15, 2015)

    • Added Travis CI integration, so master is much more stable
    • Added command line option --clean which removes the state files for script workflows #103
    • Added command line option --version which prints out the version
    • Better help command which shows all command line options
    • Adds the much-requested --command option to preset the passed-in command #99
    • Exit code updates #102
    • Color support!! #53
    • Falls back to relative dirs #47
    Source code(tar.gz)
    Source code(zip)
    fpp.0.5.7.tar.gz(124.50 KB)
    fpp.deb(60.47 KB)
  • 0.5.6(May 11, 2015)

  • 0.5.5(May 8, 2015)

  • 0.5.4(May 4, 2015)

Owner
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
Facebook
A lightweight Python module and command-line tool for generating NATO APP-6(D) compliant military symbols from both ID codes and natural language names

Python military symbols This is a lightweight Python module, including a command-line script, to generate NATO APP-6(D) compliant military symbol icon

Nick Royer 5 Dec 27, 2022
Official AIdea command line tool

AIdea CLI Official AIdea command line tool for https://aidea-web.tw. Installation Make sure you have installed both Python 3 and pip package manager.

AIdea 5 Dec 15, 2021
AthenaCLI is a CLI tool for AWS Athena service that can do auto-completion and syntax highlighting.

Introduction AthenaCLI is a command line interface (CLI) for the Athena service that can do auto-completion and syntax highlighting, and is a proud me

dbcli 192 Jan 07, 2023
Tools crack instagram + fb ayok dicoba keburu premium 😁

FITUR INSTALLASI [1] pkg update && pkg upgrade [2] pkg install git [3] pkg install python [4] pkg install python2 [5] pkg install nano [6]

Jeeck 1 Dec 11, 2021
🦎 A NeoVim plugin for highlighting visual selections like in a normal document editor!

🦎 HighStr.nvim A NeoVim plugin for highlighting visual selections like in a normal document editor! Demo TL;DR HighStr.nvim is a NeoVim plugin writte

Pocco81 222 Jan 03, 2023
Pastekan adalah website paste kode / teks sederhana

Pastekan pastekan adalah website paste kode / teks sederhana. install pip install pastekan penggunaan pastekan myfile.txt atau echo "hi" | pastekan

Sekai Kode 1 Dec 24, 2021
tiptop is a command-line system monitoring tool in the spirit of top.

Command-line system monitoring. tiptop is a command-line system monitoring tool in the spirit of top. It displays various interesting system stats, gr

Nico Schlömer 1.3k Jan 08, 2023
A command line application, written in Python, for interacting with Spotify.

spotify-py-cli A command line application, written in Python, for interacting with Spotify. The primary purpose behind developing this app was to gain

Drew Loukusa 0 Oct 07, 2021
This is a CLI program which can help you generate your own QR Code.

Python-QR-code-generator This is a CLI program which can help you generate your own QR Code. Single.py This will allow you only to input a single mess

1 Dec 24, 2021
Python codecs extension featuring CLI tools for encoding/decoding anything

CodExt Encode/decode anything. This library extends the native codecs library (namely for adding new custom encodings and character mappings) and prov

Alex 210 Dec 30, 2022
Jupyter notebook client in neovim

🪐 Jupyter-Nvim Read jupyter notebooks in neovim Note: The plugin is still in alpha stage 👾 Usage Just open any *.ipynb file and voila! ✨ Contributin

Ahmed Khalf 85 Dec 29, 2022
A CLI tool for using GLIDE to generate images from text.

Text-Glided-Diffusion Installation First clone this repository: git clone https://github.com/afiaka87/text-glided-diffusion.git cd text-glided-diffusi

Clay Mullis 68 Dec 30, 2022
Lexeme - CLI to play a word-guessing game like Wordle

What is this? Python program to play a word-guessing game like Wordle, but… More addictive because you can play it over and over and over, not just on

Dan Lenski 6 Oct 26, 2022
A command line tool to publish ads on ebay-kleinanzeigen.de

kleinanzeigen-bot Feedback and high-quality pull requests are highly welcome! About Installation Usage Development Notes License About kleinanzeigen-b

83 Dec 26, 2022
A command line interface to buy things in stregsystemet

Stregsystemet-CLI This repository is the Stregsystemet CLI, to buy things in Stregsystemet, at AAU. Use of this cli-tool is at your own risk and there

F-klubben 14 Oct 18, 2022
Analyzing the most strategic words to guess on Wordle, based on letter frequency distributions

wordle-analysis Evaluating different heuristics to determine the most effective solving strategy and building an AI-powered assistant tool to help you

Sejal Dua 9 Feb 27, 2022
Simple CLI interface for linear task manager

Linear CLI (Unmaintained) Simple CLI interface for linear task manager Usage Install: pip install linearcli Setup: Generate a pe

Mike Lyons 1 Jan 07, 2022
A CLI for advanced management of your notes with simple commands

PyNoteManager This is a CLI for advanced management of your notes with simple co

3 Dec 30, 2021
Voidlx is a terminal cli apps launcher made in python

Voidlx is a terminal cli apps launcher made in python

2 Nov 13, 2021
Patool is a portable command line archive file manager

Patool Patool is an archive file manager. Various archive formats can be created, extracted, tested, listed, searched, repacked and compared with pato

318 Jan 04, 2023