/shortpath-go

This is a small command line utility that returns a short but unique string representing the current working directory. (Go Lang)

Primary LanguageGoCreative Commons Zero v1.0 UniversalCC0-1.0

Go Report Card

The "shortpath" tool...

...is a command line utility (written in Go) that returns a string representing the current working directory where the name of each parent directory has been shortened to the smallest uniquely identifiable string for the directory in which it resides. The primary intended use case for this utility is to construct the current working directory in the command line prompt. For example, a normal prompt would contain the full path to the current working directory (pwd) in the prompt, but with my shortpath utility, the prompt is shortened considerably without removing so much information that confusion could occur.

The "shortpath" utility in use.

At the moment, it simply walks up the current working directory path and finds the shortest string for each directory that still represents that directory uniquely. This operation has the possibility of being expensive, and since it happens every time you run the command (every time the prompt is shown), it really needs optimized somehow...

Installing

    # Old:
    go get github.com/logavanc/shortpath-go

    # New:
    go install github.com/logavanc/shortpath-go/cli/shortpath@latest

Documentation

See documentation on godoc.org.

License

See the LICENSE file.