Skip to content

Compress a path to a shorter string, for use in terminal prompts.

License

Notifications You must be signed in to change notification settings

permafrost-dev/compress-path

Repository files navigation

logo

compress-path

Release Go Report Card Maintainability Code Climate technical debt


Compress and abbreviate the parts of a pathname into a shorter overall string; for use within a Zsh prompt. Adds some minor styling, such as bold text for the last path section (the current directory).

image

Setup

Download and extract compress-path to your $PATH. Then, add the following to your .zshrc:

export PS1='$(compress-path) >'

If you're using oh-my-zsh, edit your ~/.oh-my-zsh/your-theme.zsh-theme and modify the prompt_dir (or similar) function to look something like this:

prompt_dir() {
  prompt_segment blue $CURRENT_FG $(compress-path)
}

Building from source

compress-path prefers task for running tasks - see taskfile.dev for more information. If you don't have task installed, you can use make instead.

task build
# or
make build

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.