TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Facebook PathPicker

538 pointsby ben_hallabout 10 years ago

47 comments

xxbondsxxabout 10 years ago
Hey everyone, I&#x27;m in the main engineer on this project if anyone has questions.<p>Facebook has a large codebase, so naturally we have a lot of long filenames and paths. It&#x27;s a pain to type these out by hand, so I&#x27;d see a lot of (new) engineers select the text with their mouse before pasting it into the command line.<p>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 &#x2F; easy command line utility that sped up everyones&#x27; day.<p>After a while we realized this would probably be helpful to all, so we open sourced it today!
评论 #9506931 未加载
评论 #9506812 未加载
评论 #9507223 未加载
评论 #9506948 未加载
评论 #9507970 未加载
评论 #9510572 未加载
评论 #9507365 未加载
评论 #9507919 未加载
评论 #9507207 未加载
评论 #9506839 未加载
评论 #9510656 未加载
评论 #9509518 未加载
评论 #9506725 未加载
评论 #9510216 未加载
评论 #9506841 未加载
评论 #9506949 未加载
FiloSottileabout 10 years ago
One of the best little-known features of iTerm2 is Semantic History. Cmd-click on filenames and they will be opened by the default application (or you can configure an action to be performed). It&#x27;s working directory aware and works great with all output. I connected it to Sublime and it even works with line numbers.<p>(Same works for URLs, with the default browser)
评论 #9507283 未加载
评论 #9508841 未加载
评论 #9507785 未加载
评论 #9507511 未加载
评论 #9510333 未加载
评论 #9509569 未加载
评论 #9507387 未加载
TomNomNomabout 10 years ago
I have a similar workflow already that may be of use to vim users. I pipe file lists (from grep etc) into vim (using a &#x27;-&#x27; to tell vim to read from stdin):<p><pre><code> grep -nri searchterm * | vim - </code></pre> You can then use &#x27;gF&#x27; 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 &#x27;&lt;c-w&gt;gF&#x27; to open the file in a new tab, or &#x27;&lt;c-w&gt;F&#x27; to open the file in a split instead.<p>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:<p><pre><code> :%!grep -v ^test</code></pre>
评论 #9508420 未加载
fiatjafabout 10 years ago
Dozens of cool utilities like this are created every week and launched at Show HN, but without &quot;Facebook&quot; in their names you need at least 10 of them to get the many points this thread has gathered.
评论 #9508215 未加载
评论 #9511559 未加载
climaxiusabout 10 years ago
A while back I wrote a similar tool in go to scratch my own itch and use it every day: <a href="https:&#x2F;&#x2F;github.com&#x2F;robbiev&#x2F;numberwang" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;robbiev&#x2F;numberwang</a>
评论 #9507786 未加载
评论 #9510127 未加载
评论 #9511720 未加载
评论 #9507639 未加载
michaelmiorabout 10 years ago
I use fzf[0] for similar purposes.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;junegunn&#x2F;fzf" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;junegunn&#x2F;fzf</a>
评论 #9506837 未加载
iopuyabout 10 years ago
Hey guys, great tool. Just want to point out it doesn&#x27;t play well with ack (a better grep) because ack does not prepend a &quot;.&#x2F;&quot; to the file list returned from &quot;ack -l &#x27;foo&#x27;&quot;. Any way to make it work with the following:<p>junk&#x2F;foo&#x2F;bar.txt<p>instead of just<p>.&#x2F;junk&#x2F;foo&#x2F;bar.txt<p>?
评论 #9509008 未加载
评论 #9507950 未加载
stassabout 10 years ago
This is a great tool.<p>However, he authors&#x2F;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 &quot;sh&quot; which is not bash, so if there&#x27;re bash specific features in it it would fail.<p>&quot;PathPicker should work with most Bash environments&quot; -- what does that even mean?
hodgesmrabout 10 years ago
I see a lot of alternatives to this in the comments. Allow me to offer another: <a href="https:&#x2F;&#x2F;github.com&#x2F;garybernhardt&#x2F;selecta" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;garybernhardt&#x2F;selecta</a>
评论 #9507623 未加载
评论 #9507777 未加载
评论 #9509170 未加载
staunchabout 10 years ago
<i>Some people, when confronted with a command line problem, think &quot;I know, I&#x27;ll use my mouse.&quot; Now they have two problems.</i><p>I&#x27;m joking, and this looks neat, but the optimal solution is almost certainly to keep your hands on the keyboard while in the shell.
评论 #9507696 未加载
评论 #9507595 未加载
评论 #9507888 未加载
jlongsterabout 10 years ago
This is awesome. I wonder if any of this was Emacs inspired. A very common UX in Emacs is to list things in a buffer and directly manipulate the items to execute commands. For example, in dir-mode, you can select multiple files and rename them, or mark several files for deletion and execute it.<p>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.
评论 #9509498 未加载
评论 #9509791 未加载
labianchinabout 10 years ago
That is great!<p>But when using the command, it does not work with defined bash&#x2F;zsh aliases. Anyone has any idea how to do that?<p>Say I have &quot;alias g=git&quot;, when I use the command &quot;g diff&quot;, the following error happens: .fbPager.sh: line 4: g: command not found
评论 #9509071 未加载
ComputerGuruabout 10 years ago
Is there a way of using this with instructions that take only one parameter, akin to xargs or parallel?<p>i.e. Instead of calling `command file1 file2 file3 ...` it would call `command file1; command file2; command file3; ...`?
jbnicolaiabout 10 years ago
I wrote a small snippet to integrate this with tmux. Simply press &lt;Leader-i&gt; for the current buffer to be run through fpp.<p>See a small example here: <a href="http:&#x2F;&#x2F;recordit.co&#x2F;U2TYvbPC9p" rel="nofollow">http:&#x2F;&#x2F;recordit.co&#x2F;U2TYvbPC9p</a><p>And here&#x27;s the corresponding code: <a href="https:&#x2F;&#x2F;github.com&#x2F;jbnicolai&#x2F;tmux&#x2F;blob&#x2F;master&#x2F;.tmux.conf#L127" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jbnicolai&#x2F;tmux&#x2F;blob&#x2F;master&#x2F;.tmux.conf#L12...</a>
sheldonkabout 10 years ago
This reminds me of <a href="https:&#x2F;&#x2F;github.com&#x2F;mooz&#x2F;percol" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mooz&#x2F;percol</a>
评论 #9506849 未加载
muaddiracabout 10 years ago
Some of this is reminiscent of xiki: <a href="http:&#x2F;&#x2F;xiki.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;xiki.org&#x2F;</a>
pierrecabout 10 years ago
Going though this thread, so far we have fpp, selecta, peco, percol, numberwang, fzf... Wewh! They are all, how could we call it, command line selector tools? What I&#x27;d love to read is a nice comparative review of these tools.<p>Although I kind of enjoy the process of going though each one and studying how the features fit my own workflow.
评论 #9568862 未加载
评论 #9509871 未加载
renataabout 10 years ago
If you&#x27;re only using this with git, I use git-number[1] for this purpose.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;holygeek&#x2F;git-number" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;holygeek&#x2F;git-number</a>
daliwaliabout 10 years ago
Is there a reason why this is named Facebook PathPicker instead of PathPicker? It seems that the original author is giving up rights of their software to Facebook (it says copyright Facebook right in the license).<p>What troubles me is that this tool seems completely unrelated to Facebook&#x27;s business so why must they assert ownership of their employee&#x27;s side project? On the other hand, it could be the author&#x27;s intent to give up their rights to Facebook, which seems dumb, there&#x27;s nothing the author could gain from that other than the Facebook brand in front.
评论 #9510219 未加载
评论 #9513034 未加载
0x0about 10 years ago
Looks nice. Is it better than the built-in &quot;arrow-keys-browseable&quot; menu completion of zsh? (Random &quot;screenshot&quot; available at <a href="http:&#x2F;&#x2F;www.masterzen.fr&#x2F;2009&#x2F;04&#x2F;19&#x2F;in-love-with-zsh-part-one&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.masterzen.fr&#x2F;2009&#x2F;04&#x2F;19&#x2F;in-love-with-zsh-part-one...</a> under &quot;Menu selection&quot;)<p>I&#x27;ve always been wanting an integrated file picker on unix that was as efficient as the ones in the venerable 4DOS (and 4NT) shells.
namuolabout 10 years ago
Related: It would be great if your terminal were just clever enough to identify paths and allow you to click on them to open them. Many do this for <a href="http:&#x2F;&#x2F;" rel="nofollow">http:&#x2F;&#x2F;</a> links, but not fs links.<p>Bonus: include &lt;line&gt;:&lt;column&gt; 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.
hellbannerabout 10 years ago
Props for giving back.
barunabout 10 years ago
This tool is awesome. It would be better if you add a search feature in the selector UI. I know that we could do that in the command itself but it would if helpful in case we forgot previously or need further filtering<p>Also, it is failing to select the entire file if there are spaces in it
thinkingfishabout 10 years ago
Would be nice to allow filters- for example, leave out any results that match patterns in .gitignore.
serve_yayabout 10 years ago
I don&#x27;t use an editor that runs in the terminal so I only ever want a tool like this for the command mode. When you use it right it&#x27;s pretty nice, but the first time I was unceremoniously dumped into vim. (Yes I know about the EDITOR variable)
scott_karanaabout 10 years ago
And in case anyone didn&#x27;t know about something that does the same for URLs on-screen: here&#x27;s urlview.<p><a href="http:&#x2F;&#x2F;linuxcommand.org&#x2F;man_pages&#x2F;urlview1.html" rel="nofollow">http:&#x2F;&#x2F;linuxcommand.org&#x2F;man_pages&#x2F;urlview1.html</a><p>:-)
jiurenabout 10 years ago
Impressive. I was very happy with percol. Now I see other possibility. I really like the &quot;select first, then comes the command&quot; approach.<p>I hope you can add support of selecting directories, and fuzzily filtering results(like what percol does).
hammerhaabout 10 years ago
There&#x27;s a nice command line interface git client called `tig`. <a href="https:&#x2F;&#x2F;github.com&#x2F;jonas&#x2F;tig" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jonas&#x2F;tig</a>
ptmanabout 10 years ago
I like using vipe from moreutils ( <a href="https:&#x2F;&#x2F;joeyh.name&#x2F;code&#x2F;moreutils&#x2F;" rel="nofollow">https:&#x2F;&#x2F;joeyh.name&#x2F;code&#x2F;moreutils&#x2F;</a> )<p>find . |vipe | xargs ...
milinabout 10 years ago
Looks like it has issues running with nosetests. It would be awesome, if I could do nosetests runtests.py | fpp and if any test fails, i could select it and it would open it up in my editor.
trumbitta2about 10 years ago
Thanks for giving back!<p>I&#x27;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.
blagoabout 10 years ago
I use a combination of grep (to filter), awk (for projection), and xargs (to execute) to achieve similar result but it probably takes a little longer to construct.
ww520about 10 years ago
This looks awesome and very useful.<p>As an alternative, I usually just run ag to search files inside Emacs, and use Emacs to navigate the results.
liquidiseabout 10 years ago
iTerm2 has historic completion if you hit CMD + ; after typing a couple of characters. works wonders for path retrieval.
Sbnabout 10 years ago
Tangential question- how does one manage these utils on multiple machines? I use dotfiles for regular dot files.
frou_dhabout 10 years ago
Seems to trip up as soon as paths have spaces in them.<p>Nice concept though, makes a good companion for &quot;mdfind&quot; on OS X.
ameliusabout 10 years ago
This reminds me of Norton Commander :)
mortdeusabout 10 years ago
The point of piping is that output shouldn&#x27;t ever be as complicated as this...
raman325about 10 years ago
cool idea, thanks for sharing! for some reason, everything is working but the ability to move up and down, regardless of whether i use arrow keys or j&#x2F;k. any ideas?<p>EDIT: should note i am using iTerm on a Mac
vikiomega9about 10 years ago
The brew install seems broken?
评论 #9507500 未加载
评论 #9507613 未加载
Cactiabout 10 years ago
Reminds me of Helm in Emacs.
MetaMonkabout 10 years ago
This is awesome! Thanks!
mscrivoabout 10 years ago
very nice! Anyone get this working in an msysgit bash shell?
govilkabout 10 years ago
Very useful. Thanks
manan19about 10 years ago
Why is this at the top of HN? :&#x2F;
andylabout 10 years ago
This looks great. Is there a streamlined install for Ubuntu?
评论 #9507059 未加载
评论 #9507034 未加载
numairabout 10 years ago
Haven&#x27;t we learned by now, my fellow HN readers? All of Facebook&#x27;s open source &quot;gifts&quot; are patent Trojan horses. Go take a look at their PATENTS file before going anywhere near this stuff.<p>The fact that Facebook, at such a level of wealth and success, gets away with this stuff is despicable. It&#x27;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&#x27;s been well-documented...<p>If you&#x27;re a passionate engineer at Facebook working on an open source project, please go work on it somewhere else!
评论 #9508146 未加载
评论 #9509163 未加载
评论 #9508168 未加载