{"id":18275350,"url":"https://github.com/rahiel/pwds","last_synced_at":"2025-07-18T08:06:10.502Z","repository":{"id":62443120,"uuid":"64330113","full_name":"rahiel/pwds","owner":"rahiel","description":"Print the path of the current working directory, shortly.","archived":false,"fork":false,"pushed_at":"2018-03-26T10:09:59.000Z","size":9,"stargazers_count":2,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-20T05:48:45.397Z","etag":null,"topics":["bash","bash-prompt","cli","prompt","pwd","shell"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/pwds","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rahiel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-27T17:55:02.000Z","updated_at":"2025-02-05T09:33:32.000Z","dependencies_parsed_at":"2022-11-01T22:16:40.059Z","dependency_job_id":null,"html_url":"https://github.com/rahiel/pwds","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rahiel/pwds","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahiel%2Fpwds","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahiel%2Fpwds/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahiel%2Fpwds/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahiel%2Fpwds/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rahiel","download_url":"https://codeload.github.com/rahiel/pwds/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahiel%2Fpwds/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265724999,"owners_count":23817932,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","bash-prompt","cli","prompt","pwd","shell"],"created_at":"2024-11-05T12:12:35.087Z","updated_at":"2025-07-18T08:06:10.482Z","avatar_url":"https://github.com/rahiel.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pwds\n\n[![Version](https://img.shields.io/crates/v/pwds.svg)](https://crates.io/crates/pwds)\n[![Build Status](https://travis-ci.org/rahiel/pwds.svg?branch=master)](https://travis-ci.org/rahiel/pwds)\n[![License](https://img.shields.io/crates/l/pwds.svg)](https://github.com/rahiel/pwds/blob/master/LICENSE.txt)\n[![Downloads](https://img.shields.io/crates/d/pwds.svg)](https://crates.io/crates/pwds)\n\n**P**rint the path of the current **w**orking **d**irectory, **s**hortly.\n\nThe current working directory in your prompt can get uncomfortably large,\nleaving little space to type your own commands. With pwds paths like\n`/home/user/Code/rust/src/doc/nomicon` are displayed as `~/C/r/s/d/nomicon`.\n\nIt shows the first two characters for (hidden) directories that start with a\ndot. So `/home/rahiel/.config/autostart` becomes `~/.c/autostart`.\n\n# Installation\n\nInstall pwds with cargo:\n``` shell\ncargo install pwds\n```\nThe directory `~/.cargo/bin` needs to be in your PATH for your shell to find the\n`pwds` binary. Follow [this guide][path] if you need help.\n\nThen you need to customize your PS1 in your shell's initialization file, e.g.\n`.bashrc`. Here is a standard prompt, the `\\w` is an escape code for the current\nworking directory:\n``` shell\nPS1='\\[\\033[01;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '\n```\nreplace `\\w` with `$(pwds)`:\n``` shell\nPS1='\\[\\033[01;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]$(pwds)\\[\\033[00m\\]\\$ '\n```\nand enjoy a smaller prompt!\n\n[path]: https://www.rahielkasim.com/installing-programs-from-non-system-package-managers-without-sudo/\n\n# Customization\n\nBy default, paths with more than 16 characters are shortened by replacing\ndirectory names with their first character. This can be configured by setting\nthe `PWDS_LENGTH` environment variable:\n``` shell\nexport PWDS_LENGTH=10\n```\nThe current (most right) directory is never shortened.\n\n# References\n\nI encountered the concept of `pwds` in [fish][] and more recently in [xonsh][],\ntwo modern and user-friendly shells. I'd use xonsh but a few issues keep me from\nswitching. In the meantime I'm trying to improve the experience of the Bash\nshell, with as one of the results this program.\n\n* [Bash prompts](https://sanctum.geek.nz/arabesque/bash-prompts/)\n* [Alternative prompt directory shortening for Bash](https://sanctum.geek.nz/arabesque/prompt-directory-shortening/)\n* [Python prototype of pwds][pwds.py]\n\n[fish]: https://fishshell.com\n[pwds.py]: https://gist.github.com/rahiel/cdfda857534bc9dd4456e404a996e38f\n[xonsh]: http://xon.sh\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frahiel%2Fpwds","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frahiel%2Fpwds","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frahiel%2Fpwds/lists"}