Skip to content

A unix filter which outputs the filepaths found in stdin

Notifications You must be signed in to change notification settings

Soulou/path-extractor

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PathExtractor (pe)

demo

PathExtractor is a command line tool that extracts a list of files/paths from stdin.

Advantages over fpp:

  • It does only one thing : more unixy
  • You can use it with any fuzzy finder, such as fzf,peco,percol,pick,selecta
  • It doesn't wait for stdin to be finished to output the paths
  • It is faster
  • It is much smaller (easily understandable)
  • You can also use it without a fuzzy finder for programmatic usage

For example, you could write:

git status | pe

to get a list of the files that were added/changed, without all the formating

One of the most common usage is to create an alias that will automatically run :

pe + a command line fuzzy finder such as fzf + an action such as opening that file in your favorite editor.

For example, using zsh , I have as an alias:

alias -g P='| pe | fzf | read filename; [ ! -z $filename ] && vim $filename'

With bash:

bind '"PP": "| pe | fzf | read filename; [ ! -z $filename ] && vim $filename"'

So that If I run

`git status P`

or

`git status PP`

to quickly open one of the changed files in vim

Other usage ideas:

With zsh:

# Copy selected path to clipboard
alias -g C='| pe | fzf | read filename; [ ! -z $filename ] && echo -n $filename | xclip -selection c'

With bash:

bind '"CC": "| pe | fzf | read filename; [ ! -z $filename ] && echo -n $filename | xclip -selection c"'

Installation

git clone # in your go path
go test
go build
go install

About

A unix filter which outputs the filepaths found in stdin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%