An open API service indexing awesome lists of open source software.

https://github.com/permafrost-dev/compress-path

Compress a path to a shorter string, for use in terminal prompts.
https://github.com/permafrost-dev/compress-path

cli cwd go prompt terminal zsh

Last synced: 3 months ago
JSON representation

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

Awesome Lists containing this project

README

          


logo

# compress-path

[![Release](https://img.shields.io/github/release/permafrost-dev/compress-path.svg)](https://github.com/permafrost-dev/compress-path/releases/latest) [![Go Report Card](https://goreportcard.com/badge/github.com/permafrost-dev/compress-path)](https://goreportcard.com/report/github.com/permafrost-dev/compress-path) [![Maintainability](https://api.codeclimate.com/v1/badges/65f5deac2eb526f18df7/maintainability)](https://codeclimate.com/github/permafrost-dev/compress-path/maintainability) ![Code Climate technical debt](https://img.shields.io/codeclimate/tech-debt/permafrost-dev/compress-path?logo=code-climate)

---

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](https://user-images.githubusercontent.com/5508707/194622385-96e6e616-5cfa-4305-9e11-311f28f64432.png)

## Setup

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

```bash
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:

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

## Building from source

`compress-path` prefers `task` for running tasks - see [taskfile.dev](https://taskfile.dev) for more information. If you don't have `task` installed, you can use `make` instead.

```bash
task build
# or
make build
```

---

## Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

## Contributing

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

## Security Vulnerabilities

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

## Credits

- [Patrick Organ](https://github.com/patinthehat)
- [All Contributors](../../contributors)

## License

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