TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Facebook PathPicker

538 点作者 ben_hall大约 10 年前

47 条评论

xxbondsxx大约 10 年前
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 未加载
FiloSottile大约 10 年前
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 未加载
TomNomNom大约 10 年前
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 未加载
fiatjaf大约 10 年前
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 未加载
climaxius大约 10 年前
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 未加载
michaelmior大约 10 年前
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 未加载
iopuy大约 10 年前
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 未加载
stass大约 10 年前
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?
hodgesmr大约 10 年前
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 未加载
staunch大约 10 年前
<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 未加载
jlongster大约 10 年前
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 未加载
labianchin大约 10 年前
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 未加载
ComputerGuru大约 10 年前
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; ...`?
jbnicolai大约 10 年前
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>
sheldonk大约 10 年前
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 未加载
muaddirac大约 10 年前
Some of this is reminiscent of xiki: <a href="http:&#x2F;&#x2F;xiki.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;xiki.org&#x2F;</a>
pierrec大约 10 年前
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 未加载
renata大约 10 年前
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>
daliwali大约 10 年前
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 未加载
0x0大约 10 年前
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.
namuol大约 10 年前
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.
hellbanner大约 10 年前
Props for giving back.
barun大约 10 年前
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
thinkingfish大约 10 年前
Would be nice to allow filters- for example, leave out any results that match patterns in .gitignore.
serve_yay大约 10 年前
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_karana大约 10 年前
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>:-)
jiuren大约 10 年前
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).
hammerha大约 10 年前
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>
ptman大约 10 年前
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 ...
milin大约 10 年前
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.
trumbitta2大约 10 年前
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.
blago大约 10 年前
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.
ww520大约 10 年前
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.
liquidise大约 10 年前
iTerm2 has historic completion if you hit CMD + ; after typing a couple of characters. works wonders for path retrieval.
Sbn大约 10 年前
Tangential question- how does one manage these utils on multiple machines? I use dotfiles for regular dot files.
frou_dh大约 10 年前
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.
amelius大约 10 年前
This reminds me of Norton Commander :)
mortdeus大约 10 年前
The point of piping is that output shouldn&#x27;t ever be as complicated as this...
raman325大约 10 年前
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
vikiomega9大约 10 年前
The brew install seems broken?
评论 #9507500 未加载
评论 #9507613 未加载
Cacti大约 10 年前
Reminds me of Helm in Emacs.
MetaMonk大约 10 年前
This is awesome! Thanks!
mscrivo大约 10 年前
very nice! Anyone get this working in an msysgit bash shell?
govilk大约 10 年前
Very useful. Thanks
manan19大约 10 年前
Why is this at the top of HN? :&#x2F;
andyl大约 10 年前
This looks great. Is there a streamlined install for Ubuntu?
评论 #9507059 未加载
评论 #9507034 未加载
numair大约 10 年前
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 未加载