Skip to content

path-shrinker is useful to show cool directory path for your terminal in Bash

License

Notifications You must be signed in to change notification settings

oinume/path-shrinker

Repository files navigation

Software License CircleCI Codecov branch Go Doc

path-shrinker

path-shrinker is a command to shrink directory path like this.

$ path-shrinker -short -last -tilde /Users/oinuma/go/src/github.com/oinume/path-shrinker
~/g/s/g/o/path-shrinker

Install

Download a binary

You can download a binary from GitHub.

Customize your Bash prompt with path-shrinker

Define PS1 in your .bashrc or .bash_profile.

PS1='$(path-shrinker -fish) $ '

Then your terminal will show a prompt like this:

~/g/s/g/o/path-shrinker $ pwd
/Users/kazuhiro/go/src/github.com/oinume/path-shrinker

Examples

For this directory tree:

/home/
  me/
    foo/
      bar/
        quux/
      biz/     # The prefix b is ambiguous between bar and biz.

Here are the results of calling path-shrinker <option> /home/me/foo/bar/quux:

Option        Result
<none>        /h/m/f/ba/q
-l|--last     /h/m/f/ba/quux
-s|--short    /h/m/f/b/q
-t|--tilde    ~/f/ba/q
-f|--fish     ~/f/b/quux

About

path-shrinker is useful to show cool directory path for your terminal in Bash

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published