{"id":15541707,"url":"https://github.com/xavdid/truncated-directory","last_synced_at":"2026-05-01T01:31:11.133Z","repository":{"id":243576126,"uuid":"811733673","full_name":"xavdid/truncated-directory","owner":"xavdid","description":"A small utility for printing your location in the filesystem, but truncating large repo subpaths","archived":false,"fork":false,"pushed_at":"2025-08-02T05:44:55.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-11T02:22:50.533Z","etag":null,"topics":["cli","rust","shell-prompt","starship-prompt","zsh"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xavdid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-06-07T07:35:02.000Z","updated_at":"2025-08-02T05:44:59.000Z","dependencies_parsed_at":"2024-06-09T23:38:56.167Z","dependency_job_id":"ffaf0a51-e6a5-4be3-a158-5b811125dca0","html_url":"https://github.com/xavdid/truncated-directory","commit_stats":null,"previous_names":["xavdid/truncated-directory"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xavdid/truncated-directory","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xavdid%2Ftruncated-directory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xavdid%2Ftruncated-directory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xavdid%2Ftruncated-directory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xavdid%2Ftruncated-directory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xavdid","download_url":"https://codeload.github.com/xavdid/truncated-directory/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xavdid%2Ftruncated-directory/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32482460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cli","rust","shell-prompt","starship-prompt","zsh"],"created_at":"2024-10-02T12:19:12.296Z","updated_at":"2026-05-01T01:31:11.126Z","avatar_url":"https://github.com/xavdid.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# truncated-directory\n\nThis is a little Rust CLI use to display the path in my [starship](https://starship.rs/) shell prompt on macOS and Linux. It's based on [this issue](https://github.com/starship/starship/issues/4199).\n\n## Installation\n\nIt's not available in a package manager, so just clone and compile it on your own. You can point starship it, wherever it lives. See [how I do it](https://github.com/xavdid/dotfiles/blob/ba7b811467cf2d27659670e326a85470981e616b/config/starship.toml#L60-L66) if you want an example of usage.\n\nTo compile, run `just build` (after installing [just](https://github.com/casey/just)). By default it'll dump the binary into `~/bin` but you can also pass a different directory (e.g. `just build some/directory`).\n\n## Examples\n\nHere's how each of the following directories is displayed:\n\n```\n/                              \u003c-- /\n└── Users/                     \u003c-- /Users\n    └── xavdid/                \u003c-- 🏠 ~\n        ├── projects/          \u003c-- ~/projects\n        │   └── some-repo/     \u003c-- some-repo\n        │       └── a/         \u003c-- some-repo/a\n        │           └── b/     \u003c-- some-repo/a/b\n        │               └── c/ \u003c-- some-repo/…/b/c\n        └── Desktop/           \u003c-- ~/Desktop\n            └── d/             \u003c-- ~/Desktop/d\n                └── e/         \u003c-- Desktop/d/e\n                    └── f/     \u003c-- d/e/f\n```\n\n## Logic\n\nIt prints the current directory based on the following logic:\n\n- if not under a git repo:\n  - the current directory and (at most) the two above it.\n  - replaces home with `~` when visible\n- if under a git repo:\n  - always show the directory of the repo root\n  - show at most 2 directories under that\n  - if you're more than two directories down from the repo root, truncate everything between\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxavdid%2Ftruncated-directory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxavdid%2Ftruncated-directory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxavdid%2Ftruncated-directory/lists"}