{"id":23449914,"url":"https://github.com/cjus/godir","last_synced_at":"2025-09-13T03:43:20.118Z","repository":{"id":267840662,"uuid":"902512140","full_name":"cjus/godir","owner":"cjus","description":"Goto Directory - A fuzzy directory navigation tool for command line Ninjas","archived":false,"fork":false,"pushed_at":"2024-12-17T17:45:48.000Z","size":513,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-11T22:04:25.193Z","etag":null,"topics":["cli","tools"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cjus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2024-12-12T17:57:06.000Z","updated_at":"2024-12-30T22:31:16.000Z","dependencies_parsed_at":"2024-12-12T19:30:10.302Z","dependency_job_id":"b2322735-3786-4199-98a8-22046f6f8d17","html_url":"https://github.com/cjus/godir","commit_stats":null,"previous_names":["cjus/godir"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cjus/godir","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjus%2Fgodir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjus%2Fgodir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjus%2Fgodir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjus%2Fgodir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cjus","download_url":"https://codeload.github.com/cjus/godir/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjus%2Fgodir/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274915586,"owners_count":25373193,"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","status":"online","status_checked_at":"2025-09-13T02:00:10.085Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","tools"],"created_at":"2024-12-23T23:30:42.527Z","updated_at":"2025-09-13T03:43:20.056Z","avatar_url":"https://github.com/cjus.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# godir\nGoto Directory - A fuzzy directory navigation tool for command line Ninjas\n\n![godir](./godir.jpg)\n\nVery early in my career, I built a command line utility in C/Assembly called `gd` - \"go directory\" that allowed me to navigate to directories based on patterns. I've been missing that little tool ever since. So, I rebuilt it in Rust.\n\nGodir supports direct navigation using relative or absolute paths:\n\n```sh\ngodir ../projects     # Navigate to relative path\ngodir /Users/name/dev # Navigate to absolute path\ngodir ~/dev/project   # Navigate using shell expansion\n```\n\nWhen using a path (instead of a pattern), godir will:\n1. Expand the path to its full canonical form\n2. Verify it's a valid directory\n3. Add it to the configuration file if not already present\n4. Navigate to the directory\n\nThis makes it easy to add new directories to your configuration while navigating to them.\n\n## Other examples\n\n```sh\ngodir . # Matches the current directory and adds it to the configuration file\ngodir dev # Matches any directory containing \"dev\"\ngodir ^/Users # Matches directories starting with \"/Users\"\ngodir project$ # Matches directories ending with \"project\"\ngodir dev/./src # Matches paths containing \"dev/\" followed by any characters, then \"/src\"\ngodir 'test|prod' # Matches directories containing either \"test\" or \"prod\"\ngodir 'lionheart.*crons' # Matches directories containing \"lionheart\" followed by any characters, then \"crons\": ~/dev/lionheart-backend/Lionheart-Boreal/app/crons\n```\n\n## Pattern Expressions\n\nGodir supports Regex pattern matching expressions:\n\n### Basic Patterns\n- `foo` - Matches any directory containing \"foo\"\n- `^foo` - Matches directories that start with \"foo\"\n- `foo$` - Matches directories that end with \"foo\"\n- `foo|bar` - Matches directories containing either \"foo\" or \"bar\"\n\n### Directory Path Patterns\n- `dev/foo` - Matches directories containing \"dev/foo\"\n- `/Users/name` - Matches exact path segments\n- `^/Users/name` - Matches paths starting from root\n\n### Special Characters\n- `.` - Matches any single character\n- `.*` - Matches zero or more of any character\n- `\\w` - Matches word characters (letters, digits, underscore)\n- `\\d` - Matches digits\n- `\\s` - Matches whitespace\n\n## Installation\n\nOn Mac's you can brew install godir.\n\n```sh\nbrew tap cjus/godir\nbrew install godir\n```\n\nMake sure to follow the post install instructions.\n\nPrebuilt binaries are also available for macOS, Linux, and Windows in the [releases](https://github.com/cjus/godir/releases) section. Download the appropriate binary for your system and add it to your PATH.\n\n### Unix-based Systems (macOS/Linux)\nTo ensure `godir` can change the current shell directory, add this shell function to your shell's configuration file (~/.bashrc, ~/.zshrc, etc.):\n\nReplace `PATH_TO_GODIR` with the path to the `godir` binary.\n```sh\ngodir() {\n    local output\n    output=\"$(command PATH_TO_GODIR/godir \"$@\")\"\n    if [ $? -eq 0 ]; then\n        if [[ \"$1\" == \"--help\" ]] || [[ \"$1\" == \"-h\" ]] || [[ \"$1\" == \"--version\" ]] || [[ \"$1\" == \"-V\" ]] || [[ \"$1\" == \"--list\" ]] || [[ \"$1\" == \"-l\" ]]; then\n            echo \"$output\"\n        elif [ -n \"$output\" ]; then\n            cd \"$output\"\n        fi\n    fi\n}\n```\n\n### Windows\nFor Windows PowerShell, add this function to your PowerShell profile (usually at `$PROFILE`):\n\n```powershell\nfunction godir {\n    $output = \u0026 godir.exe $args\n    if ($LASTEXITCODE -eq 0) {\n        if ($args -contains \"--help\" -or $args -contains \"-h\" -or $args -contains \"--version\" -or $args -contains \"-V\" -or $args -contains \"--list\" -or $args -contains \"-l\") {\n            Write-Output $output\n        }\n        elseif ($output) {\n            Set-Location $output\n        }\n    }\n}\n```\n\nThen reload your shell configuration:\n- Unix: `source ~/.bashrc` (or ~/.zshrc)\n- Windows: `. $PROFILE`\n\n## Usage\n\n```sh\ngodir \u003cpattern\u003e\n```\n\nPro Tip: to quickly add the current directory to the configuration file, use the `.` pattern.\n\n```sh\ngodir .\n```\n\n---\n\n## Usage tips\n\nThe `godir` command maintains an editable configuration file. You can find the `directories.json` file in the `.godir` directory under the user's home directory. The configuration file is used to store the directories that `godir` knows about.\n\nHere's an example of what the `directories.json` file looks like:\n\n```json\n{\n  \"directories\": [\n    \"/Users/cjus/dev/commercial\",\n    \"/Users/cjus/dev/commercial/apps/demo-redis\",\n    \"/Users/cjus/dev/godir\",\n    \"/Users/cjus/dev/moose\",\n    \"/Users/cjus/dev/moose_redis\",\n    \"/Users/cjus/dev/redis-user-create\"\n  ],\n  \"excludes\": [\n    \".git\",\n    \".next\",\n    \"/Applications\",\n    \"/cores\",\n    \"/Library\",\n    \"/private\",\n    \"/System\",\n    \"/usr\",\n    \"/var\",\n    \"/Volumes\",\n    \"dist\",\n    \"iCloud\",\n    \"node_modules\",\n    \"target\"\n  ]\n}\n```\n\nManually edit the configuration file to add or remove directories.\n\nTo exclude directories, add related patterns to the `excludes` array.\n\nNotes:\n* If you use a pattern that `godir` doesn't reconize then it will give you the option to add a directory path on the spot or ask if you'd like it to perform a full directory scan.  It will then add the directory path(s) it matches to the configuration file.\n* After a full directory scan, you should edit the `~/.godir\\directories.json` file to cleanup any entries that you don't care about.  You can also add patterns to the `excludes` array to exclude directories from future scans.\n\nRemember, to quickly add the current directory to the configuration file, use the `.` pattern.\n\n```sh\ngodir .\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcjus%2Fgodir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcjus%2Fgodir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcjus%2Fgodir/lists"}