]> Sergey Matveev's repositories - path-extractor.git/blob - README.md
Shouldn't contain \
[path-extractor.git] / README.md
1 # PathExtractor (pe)
2
3 ![demo](https://raw.github.com/edi9999/i/master/demo.gif)
4
5 PathExtractor is a command line tool that extracts a list of files/paths from stdin.
6
7 Advantages over [fpp](https://github.com/facebook/PathPicker):
8
9  * It does only one thing : more unixy
10  * You can use it with any fuzzy finder, such as [fzf](https://github.com/junegunn/fzf),[peco](https://github.com/peco/peco),[percol](https://github.com/mooz/percol),[pick](https://github.com/thoughtbot/pick),[selecta](https://github.com/garybernhardt/selecta/)
11  * It doesn't wait for stdin to be finished to output the paths
12  * It is faster
13  * It is much smaller (easily understandable)
14  * You can also use it without a fuzzy finder for programmatic usage
15
16 For example, you could write:
17
18     git status | pe
19
20 to get a list of the files that were added/changed, without all the formating
21
22 One of the most common usage is to create an alias that will automatically run :
23
24   `pe` + a command line fuzzy finder such as fzf + an action such as opening that file in your favorite editor.
25
26 For example, using `zsh` , I have as an alias:
27
28     alias -g P='| pe | fzf | read filename; [ ! -z $filename ] && vim $filename'
29
30 With `bash`:
31
32     bind '"PP": "| pe | uniq | fzf | while read filename; do [ ! -z $filename ] && </dev/tty vim $filename; done\n'
33
34 So that If I run
35
36     `git status P`
37
38 or
39
40     `git status PP`
41
42 to quickly open one of the changed files in vim
43
44 Other usage ideas:
45
46 With zsh:
47
48     # Copy selected path to clipboard
49     alias -g C='| pe | fzf | read filename; [ ! -z $filename ] && echo -n $filename | xclip -selection c'
50
51 With bash:
52
53     bind '"CC": "| pe | fzf | read filename; [ ! -z $filename ] && echo -n $filename | xclip -selection c\n"'
54
55 # Installation
56
57 ```
58 go get github.com/edi9999/path-extractor/path-extractor
59 ```
60
61 You will have the `path-extractor` in your `$GOPATH/bin` directory which you can rename or alias to `pe`
62
63 # Binaries
64
65 They are no binaries for now (you have to build it yourself), but one idea would be to use [goxc](https://github.com/laher/goxc) to compile it on multiple platforms