{"id":13398318,"url":"https://github.com/facebook/PathPicker","last_synced_at":"2025-03-14T02:31:17.865Z","repository":{"id":31325081,"uuid":"34887588","full_name":"facebook/PathPicker","owner":"facebook","description":"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.","archived":false,"fork":false,"pushed_at":"2024-09-05T13:30:40.000Z","size":1460,"stargazers_count":5150,"open_issues_count":23,"forks_count":279,"subscribers_count":123,"default_branch":"main","last_synced_at":"2025-03-05T16:18:55.538Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://facebook.github.io/PathPicker/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/facebook.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-05-01T03:05:54.000Z","updated_at":"2025-03-04T10:43:07.000Z","dependencies_parsed_at":"2024-04-09T15:54:15.469Z","dependency_job_id":"75082a5b-2bcd-421a-8eef-634b2535f5e3","html_url":"https://github.com/facebook/PathPicker","commit_stats":{"total_commits":542,"total_committers":86,"mean_commits":"6.3023255813953485","dds":0.5166051660516605,"last_synced_commit":"c1dd1f7fc4dae5aa807218cf086942f1c9241783"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebook%2FPathPicker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebook%2FPathPicker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebook%2FPathPicker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebook%2FPathPicker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/facebook","download_url":"https://codeload.github.com/facebook/PathPicker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243511659,"owners_count":20302594,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T19:00:22.638Z","updated_at":"2025-03-14T02:31:17.214Z","avatar_url":"https://github.com/facebook.png","language":"Python","readme":"# PathPicker\n\n[![tests](https://github.com/facebook/PathPicker/workflows/tests/badge.svg)](https://github.com/facebook/PathPicker/actions) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nFacebook PathPicker is a simple command line tool that solves the perpetual\nproblem of selecting files out of bash output. PathPicker will:\n* Parse all incoming lines for entries that look like files\n* Present the piped input in a convenient selector UI\n* Allow you to either:\n    * Edit the selected files in your favorite `$EDITOR`\n    * Execute an arbitrary command with them\n\nIt is easiest to understand by watching a simple demo:\n\n\u003ca href=\"https://asciinema.org/a/19519\" target=\"_blank\"\u003e\u003cimg src=\"https://asciinema.org/a/19519.png\" width=\"597\"/\u003e\u003c/a\u003e\n\n## Examples\n\nAfter installing PathPicker, using it is as easy as piping into `fpp`. It takes\na wide variety of input -- try it with all the options below:\n\n* `git status | fpp`\n* `hg status | fpp`\n* `git grep \"FooBar\" | fpp`\n* `grep -r \"FooBar\" . | fpp`\n* `git diff HEAD~1 --stat | fpp`\n* `find . -iname \"*.js\" | fpp`\n* `arc inlines | fpp`\n\nand anything else you can dream up!\n\n## Requirements\n\nPathPicker requires Python 3.\n\n### Supported Shells\n\n* Bash is fully supported and works the best.\n* ZSH is supported as well, but won't have a few features like alias expansion in command line mode.\n* 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.\n\n## Installing PathPicker\n\n### Homebrew\n\nInstalling PathPicker is easiest with [Homebrew for mac](http://brew.sh/):\n\n* `brew update` (to pull down the recipe since it is new)\n* `brew install fpp`\n\n### Linux\n\nOn Debian-based systems, run these steps:\n[fakeroot](https://wiki.debian.org/FakeRoot):\n\n```\n$ git clone https://github.com/facebook/PathPicker.git\n$ cd PathPicker/debian\n$ ./package.sh\n$ ls ../pathpicker_*_all.deb\n```\n\nOn Arch Linux, PathPicker can be installed from Arch User Repository (AUR).\n([The AUR fpp-git package](https://aur.archlinux.org/packages/fpp-git/).)\n\nIf you are on another system, or prefer manual installation, please\nfollow the instructions given below.\n\n### Manual Installation\n\nIf you are on a system without Homebrew, it's still quite easy to install\nPathPicker, since it's essentially just a bash script that calls some Python. These\nsteps more-or-less outline the process:\n\n* `cd /usr/local/ # or wherever you install apps`\n* `git clone https://github.com/facebook/PathPicker.git`\n* `cd PathPicker/`\n\nHere we create a symbolic link from the bash script in the repo\nto `/usr/local/bin/` which is assumed to be in the current\n`$PATH`:\n\n* `ln -s \"$(pwd)/fpp\" /usr/local/bin/fpp`\n* `fpp --help # should work!`\n\n### Add-ons\n\nFor tmux users, you can additionally install `tmux-fpp` which adds a key combination to run PathPicker on the last received `stdout`.\nThis makes jumping into file selection mode even easier. ([Check it out here!](https://github.com/tmux-plugins/tmux-fpp))\n\n\n## Advanced Functionality\n\nAs mentioned above, PathPicker allows you to also execute arbitrary commands using the specified files.\nHere is an example showing a `git checkout` command executed against the selected files:\n\n\u003ca href=\"https://asciinema.org/a/19520\" target=\"_blank\"\u003e\u003cimg src=\"https://asciinema.org/a/19520.png\" width=\"597\"/\u003e\u003c/a\u003e\n\nThe selected files are appended to the command prefix to form the final command. If you need the files\nin the middle of your command, you can use the `$F` token instead, like:\n\n`cat $F | wc -l`\n\nAnother important note is that PathPicker, by default, only selects files that exist on the filesystem. If you\nwant to skip this (perhaps to selected deleted files in `git status`), just run PathPicker with the `--no-file-checks` (or `-nfc`, for short) flag.\n\n## How PathPicker works\n\nPathPicker is a combination of a bash script and some small Python modules.\nIt essentially has three steps:\n\n* Firstly, the bash script redirects all standards out into a python module that\nparses and extracts out filename candidates. These candidates are extracted with a series of\nregular expressions, since the input to PathPicker can be any `stdout` from another program. Rather\nthan make specialized parsers for each program, we treat everything as noisy input, and select candidates via\nregexes. To limit the number of calls to the filesystem (to check existence), we are fairly restrictive on the\ncandidates we extract.\n\nThe downside to this is that files that are single words, with no extension (like `test`), that are not prepended by\na 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.\n\n* 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\nto execute.\n\n* Lastly, the python script outputs a command to a bash file that is later\nexecuted by the original bash script.\n\nIt's not the most elegant architecture in the world but, in our opinion, it provides a lot of utility.\n\n## Documentation \u0026 Configuration\n\nFor all documentation and configuration options, see the output of `fpp --help`.\n\n## Join the PathPicker community\n\nSee the [CONTRIBUTING.md](https://github.com/facebook/PathPicker/blob/master/CONTRIBUTING.md) file for how to help out.\n\n## License\n\nPathPicker is MIT licensed.\n","funding_links":[],"categories":["Python","Command-line Tools","资源列表","\u003ca id=\"tag-dev\" href=\"#tag-dev\"\u003eDev\u003c/a\u003e","others","Command Line Utilities","\u003ca name=\"core\"\u003e\u003c/a\u003ecore","命令行工具","Tools","[💾 sysadmin-devops](https://github.com/stars/ketsapiwiq/lists/sysadmin-devops)","Command-line Tools [🔝](#readme)","Awesome Python","Command-Line Productivity"],"sub_categories":["命令行工具","\u003ca id=\"tag-dev-other\" href=\"#tag-dev-other\"\u003eOther Dev projects\u003c/a\u003e","Tools","Python","Others","Command-line Tools"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebook%2FPathPicker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffacebook%2FPathPicker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebook%2FPathPicker/lists"}