{"id":22769691,"url":"https://github.com/bfontaine/which","last_synced_at":"2025-07-14T08:16:38.544Z","repository":{"id":35586636,"uuid":"39859381","full_name":"bfontaine/which","owner":"bfontaine","description":"the `which` you’re used to, written in Go.","archived":false,"fork":false,"pushed_at":"2022-10-18T09:48:40.000Z","size":13,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-14T03:52:57.165Z","etag":null,"topics":["cli","go","tool"],"latest_commit_sha":null,"homepage":"","language":"Go","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/bfontaine.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-28T21:47:08.000Z","updated_at":"2021-10-26T10:08:10.000Z","dependencies_parsed_at":"2022-09-18T00:21:34.195Z","dependency_job_id":null,"html_url":"https://github.com/bfontaine/which","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/bfontaine/which","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfontaine%2Fwhich","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfontaine%2Fwhich/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfontaine%2Fwhich/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfontaine%2Fwhich/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bfontaine","download_url":"https://codeload.github.com/bfontaine/which/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfontaine%2Fwhich/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265262561,"owners_count":23736414,"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":["cli","go","tool"],"created_at":"2024-12-11T15:13:53.945Z","updated_at":"2025-07-14T08:16:38.504Z","avatar_url":"https://github.com/bfontaine.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# which\n\n**which** is a Go implementation of the UNIX command of the same name.\n\nIts main (and only) advantage over the standard command is its `-l` flag that makes it resolve symbolic links. This can\nbe especially useful when using [Homebrew](https://brew.sh/).\n\n## Usage\n\nThe executable works exactly like the `which` command:\n\n    which [-as] program ...\n\nIn addition, it supports a `-l` command which makes `which` resolve symbolic\nlinks before printing the paths.\n\nHowever, note that this implementation doesn’t support combined flags\n(e.g. `-al` won’t work, you’ll have to use `-a -l`).\n\nYou’ll have to ensure that `$GOPATH/bin` is at the beginning of your `PATH`\nenvironnment variable if you want to use this implementation instead of the\noriginal one.\n\n## Install\n\n    go install github.com/bfontaine/which@1.0.1\n\n## Example\n\n```\n$ which vim\n/usr/local/bin/vim\n\n$ which -l vim\n/usr/local/Cellar/vim/7.4.712_1/bin/vim\n\n$ which -a vim\n/usr/local/bin/vim\n/usr/bin/vim\n```\n\n## Library\n\n**which** is also usable as a Go library:\n\n```go\npackage main\n\nimport \"github.com/bfontaine/which/which\"\n\n// get the first executable in $PATH\nexecutable := which.One(\"vim\")\n\n// get all executables in $PATH\nexecutables := which.All(\"vim\")\n```\n\n## Why?\n\nI know it doesn’t really make sense to re-write a simple tool like `which`, but\nI needed the `-l` option so I wrote this. I use [Homebrew](http://brew.sh/) on\nmacOS and it installs binaries in a directory then symlinks them into\n`/usr/local/bin/`, which means it’s not possible to get the original path by\nusing the original `which` command alone.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbfontaine%2Fwhich","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbfontaine%2Fwhich","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbfontaine%2Fwhich/lists"}