Skip to content
path-shrinker is useful to show cool directory path for your terminal in Bash
Go Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
cmd/path-shrinker
shrinker_test
tools
.envrc.sample
.gitignore
.goreleaser.yml
LICENSE
Makefile
README.md
go.mod
go.sum
transformer.go
transformer_test.go

README.md

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
You can’t perform that action at this time.