Facebook has a large codebase, so naturally we have a lot of long filenames and paths. It's a pain to type these out by hand, so I'd see a lot of (new) engineers select the text with their mouse before pasting it into the command line.
This is pretty inefficient and I knew there had to be a better way, so a few of us started hacking on a set of python regexes and a curses UI. Before long we had a pretty simple / easy command line utility that sped up everyones' day.
After a while we realized this would probably be helpful to all, so we open sourced it today!
One thing I noticed: FPP gets confused by filenames with multiple dots. If a file is named for example "dev_backup.ldif.gz", FPP thinks that "ldif.gz" is the entire file name.
For instance, we currently match on "add/remove" output from git status which is less than fortunate. For performance reasons we don't actually go check if each of those files exists (since sometimes you want to pipe hundreds of results into fpp [EDIT: and are using an expandrive or network mount])
subl `ag -l Foo`
https://gist.github.com/aristus/2304335
One of the most useful features is range selection syntax, eg, run git rm on items 4-16.
Maybe we'll integrate some kind of line-number-selection-mode one day!
What did the more experienced engineers do differently?
I've been using Pick by Thoughtbot [1] for the same purpose, but if I understand correctly fpp will automatically extract file paths from any command without me needing to chain in awk/grep ?
I am still thinking about different selection modes and how the UI would work. Usually I see a need to either copy several full lines, or columns from a table like structure (rectangle selection) or from a regex.
Looks good so far!
Thanks for establishing something that embraces this.
I struggle to do everything with Powershell, but almost everything I do has a mouse input. I use a gaming mouse for system administration - a Razer Naga Epic with the 12 thumb buttons.
They're a 3x4 array; I bind them to:
Row One
1. F5
2. Up arrow
3. F2
Row Two
4. Left arrow
5. Down arrow
6. Right arrow
Row Three
7. Tab
8. Delete
9. Backspace
Row Four
10. Enter
11. Spacebar
12. ESC
I can do the work of 2-3 admins, and I'm faster than poorly-written scripts.ossreality 6 minutes ago [dead]
lol, what are you talking about, this isn't mouse-enabled?
(Same works for URLs, with the default browser)
grep -nri searchterm * | vim -
You can then use 'gF' over a file name to open the file in question (and be taken to the right line number if specified in the form somefile.txt:42). You can use '<c-w>gF' to open the file in a new tab, or '<c-w>F' to open the file in a split instead.As an added bonus you can re-filter the file list from within vim to, for example, remove things from a test directory without having to run the original command again:
:%!grep -v ^testWhy do you think so? My experience was quite the opposite... One can argue that large companies don't care about their reputation as much as small companies and individuals do as responsibility gets diluted among the larger number of people. This was certainly the case with most of the tech companies.
Have you seen the "google" group/whatever it's called on Github? A lot of the repos that are posted here have large disclaimers, or here in the comments, that the project is not associated with Google itself but rather by the particular employees that are working on it. So Google doesn't mind letting their employees put up repos of their misc "scratch their itch"/side-project/pet projects, it seems.
> Plus, they have a lot of brilliant developers to work on this stuff.
Someone works at Google/Facebook/... -> commence reflex fawning.
https://github.com/ramses0/bash-dialog
...depends on dialog command being installed, or you could use bash's built-in "select" command.
Glad more people are working in the productivity space though!
anycommand $(fzf)
junk/foo/bar.txt
instead of just
./junk/foo/bar.txt
?
-- Try to detect the top-level version control directory -- Use that if one is found
But we could possibly pipe the current working directory into the python context from bash and go from there
However, he authors/documentation seem to be confused about bash vs shell. In the documentation these terms seems to be used interchangeably. In the code, the main script depends on bash directly (and for it to be installed in a very particular place) but does not seem to use any bash-specific features. However, the script it launches at the end is launched via "sh" which is not bash, so if there're bash specific features in it it would fail.
"PathPicker should work with most Bash environments" -- what does that even mean?
I'm joking, and this looks neat, but the optimal solution is almost certainly to keep your hands on the keyboard while in the shell.
It really is a fantastic way to bring an interactive interface into a text-based world. This looks like a cool way to bring it to the terminal.
But when using the command, it does not work with defined bash/zsh aliases. Anyone has any idea how to do that?
Say I have "alias g=git", when I use the command "g diff", the following error happens: .fbPager.sh: line 4: g: command not found
i.e. Instead of calling `command file1 file2 file3 ...` it would call `command file1; command file2; command file3; ...`?
See a small example here: http://recordit.co/U2TYvbPC9p
And here's the corresponding code: https://github.com/jbnicolai/tmux/blob/master/.tmux.conf#L12...
git checkout $(git branch | percol)
Since I had to almost compose my command beforehand rather than decide once I saw the output. So we take the opposite approach. Great UI though!
Although I kind of enjoy the process of going though each one and studying how the features fit my own workflow.
What troubles me is that this tool seems completely unrelated to Facebook's business so why must they assert ownership of their employee's side project? On the other hand, it could be the author's intent to give up their rights to Facebook, which seems dumb, there's nothing the author could gain from that other than the Facebook brand in front.
I've always been wanting an integrated file picker on unix that was as efficient as the ones in the venerable 4DOS (and 4NT) shells.
Bonus: include <line>:<column> in the path since most editors support jumping in the file with this format, which would make it much easier to navigate to a specific spot in your code where an error is occurring from the output of the error.
Also, it is failing to select the entire file if there are spaces in it
http://linuxcommand.org/man_pages/urlview1.html
:-)
I hope you can add support of selecting directories, and fuzzily filtering results(like what percol does).
find . |vipe | xargs ...
I'm not sure how this would speed up my workflow more than a combination of tab completion, CTRL-R, and quick rushes of double-click-to-select-then-third-button-to-paste, though.
As an alternative, I usually just run ag to search files inside Emacs, and use Emacs to navigate the results.
Nice concept though, makes a good companion for "mdfind" on OS X.
EDIT: should note i am using iTerm on a Mac
In the meantime you can try the manual installation method listed in the README: https://github.com/facebook/pathpicker/
@itsbits Why do you say that? curious if you found anything
$ sudo git clone git@github.com:facebook/PathPicker.git
Cloning into 'PathPicker'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Any ideas? Thanks.EDIT: Nevermind. It's an issue with using sudo to git. I can use my own account, but I can't do it in /usr/local.
The fact that Facebook, at such a level of wealth and success, gets away with this stuff is despicable. It's also an insult to the great legacy of companies like Sun, which gave freely without strangling its beneficiaries. It says a lot about the culture and leadership at the company, but that's been well-documented...
If you're a passionate engineer at Facebook working on an open source project, please go work on it somewhere else!
>Notwithstanding the foregoing, if Facebook or any of its subsidiaries or corporate affiliates files a lawsuit alleging patent infringement against you in the first instance, and you respond by filing a patent infringement counterclaim in that lawsuit against that party that is unrelated to the Software, the license granted hereunder will not terminate under section (i) of this paragraph due to such counterclaim.
Source: https://github.com/facebook/PathPicker/blob/master/PATENTS
See also the announcement of the change: https://news.ycombinator.com/item?id=9356508
An older version of their patents file used language that suggested to some that the license would be void if you attempted to defend against a patent suit from Facebook and it could therefore be dangerous to use.
They recently updated the file to clarify some terms, particularly the one the parent is complaining about, and I haven't heard anybody complaining about the new language.