{"id":44436516,"url":"https://github.com/fsgo/bin-auto-switcher","last_synced_at":"2026-02-12T14:00:45.777Z","repository":{"id":57624526,"uuid":"398736631","full_name":"fsgo/bin-auto-switcher","owner":"fsgo","description":null,"archived":false,"fork":false,"pushed_at":"2025-10-25T05:45:18.000Z","size":132,"stargazers_count":17,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-25T07:21:13.717Z","etag":null,"topics":["git","git-hooks","go"],"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/fsgo.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-08-22T07:06:48.000Z","updated_at":"2025-10-25T05:44:59.000Z","dependencies_parsed_at":"2024-09-06T10:27:44.794Z","dependency_job_id":"2d5cc0a7-5602-4eef-839a-f36b7ff9ff13","html_url":"https://github.com/fsgo/bin-auto-switcher","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/fsgo/bin-auto-switcher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fsgo%2Fbin-auto-switcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fsgo%2Fbin-auto-switcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fsgo%2Fbin-auto-switcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fsgo%2Fbin-auto-switcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fsgo","download_url":"https://codeload.github.com/fsgo/bin-auto-switcher/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fsgo%2Fbin-auto-switcher/sbom","scorecard":{"id":412702,"data":{"date":"2025-08-11","repo":{"name":"github.com/fsgo/bin-auto-switcher","commit":"7c23965c2d24f99961a1ad82f49ca0926bff0826"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/go.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/fsgo/bin-auto-switcher/go.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/fsgo/bin-auto-switcher/go.yml/master?enable=pin","Warn: goCommand not pinned by hash: .github/workflows/go.yml:29","Warn: goCommand not pinned by hash: .github/workflows/go.yml:32","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 goCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":7,"reason":"3 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2025-3487 / GHSA-hcg3-q754-cr77","Warn: Project is vulnerable to: GO-2025-3503 / GHSA-qxp5-gwg8-xv66","Warn: Project is vulnerable to: GO-2025-3595 / GHSA-vvgc-356p-c3xw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T23:07:05.994Z","repository_id":57624526,"created_at":"2025-08-18T23:07:05.994Z","updated_at":"2025-08-18T23:07:05.994Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29367806,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T08:51:36.827Z","status":"ssl_error","status_checked_at":"2026-02-12T08:51:26.849Z","response_time":55,"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":["git","git-hooks","go"],"created_at":"2026-02-12T14:00:27.922Z","updated_at":"2026-02-12T14:00:45.770Z","avatar_url":"https://github.com/fsgo.png","language":"Go","readme":"# Bin-Auto-Switcher\n\n1. Auto switch binary in different directories by rules. \n2. Execute pre-hooks and post-hooks.\n\n## 1. Install\n\n```bash\ngo install github.com/fsgo/bin-auto-switcher/bas@latest\n```\n\n## 2. Config\n`{CurrentDir}/.bas/{cmd}.toml` or `~/.config/bas/{cmd}.toml`\n\n## 3. Example\n### 3.1 Auto Switch Go versions\nyou should already [install multiple Go versions](https://github.com/fsgo/smart-go-dl)\n\n#### 1.create alias or symlink for `go`:\n```bash\nbas ln go.latest go\n```\n\nor\n\n```bash\ncd ~/go/bin/\nln -s bas go\n```\n\n\n#### 2. edit config file `go.toml` (`~/.config/bas/go.toml`):\n```toml\n# config for 'go' command\n\n# 1th is the default rule\n[[Rules]]\nCmd = \"go.latest\"          # command, Required\n# Env =[\"k1=v1\",\"k2=v2\"]   # extra env variable, Optional\n# Args = [\"-k\",\"-v\"]       # extra cmd args, Optional\n[Rules.Spec]\n# use go version defined in go.mod if ‘go1.xx’( e.g. go1.21) exists\n# go1.xx should be found in $PATH\n# if value is \"\",\"no\", skip it\nGoVersionFile = \"go.mod\"\n# set env GOWORK=off if module not defined in go.work\n# if value is \"\",\"no\", skip it\nGoWork = \"auto\"\n\n# [[Rules.Pre]]            # Optional, pre command\n# Match = \"\"               # Optional, regexp to match Args. \"^add\\\\s\" will match \"git add .\"\n# Cmd   = \"\"               # Required\n# Args  = [\"\"]             # Optional\n# Env =[\"k3=v3\",\"k2=v2\"]   # extra env variable, Optional\n# AllowFail = true/false   # Optional\n# Timeout = \"2m\"           # Optional, exec timeout, default 1 min\n\n# [[Rules.Post]]           # Optional, post command\n# Cmd  = \"\"\n# Args = [\"\"]\n\n# rule for some dir\n[[Rules]]\n# when in these dirs, this rule can be match\nDir = [\"~/workspace/fsgo/myserver\"]\nCmd = \"go1.19\"\n```\n\n#### 3. Check It:\n----------\n① At  `~/workspace/fsgo/myserver`: \n```bash\n# go version\ngo version go1.17 darwin/amd64\n```\n-----------\n②  At other dirs (e.g.: `~/workspace/`):\n```bash\n# go version\ngo version go1.19.3 darwin/amd64\n```\n\n### 3.2 git hooks\n1. create Symlink for `git`:\n```bash\nbas ln /usr/local/bin/git git\n```\n\n2. edit config: `~/.config/bas/git.toml`\n```toml\n# Trace = true # enable trace log global\n\n[[Rules]]\nCmd = \"/usr/local/bin/git\"    # the raw Cmd Path, or empty it will auto detect\n\n# with env \"BAS_NoHook=true\" or \"bas=off\" to disable Pre and Post Hooks\n\n[[Rules.Pre]]\nMatch = \"^add\\\\s\" # when exec \"git add\" subCommand\n# Trace = true\n# find pre-ci.sh and execute it if exists\nCmd   = \"inner:find-exec\"\nArgs  = [\"-name\",\"pre-ci.sh\",\"bash\",\"pre-ci.sh\"]\n\n[[Rules.Pre]]               \nMatch = \"^add\\\\s\"       \nCond  = [\"go_module\"]   # condition: in go module dir\nCmd   = \"gorgeous\"      # https://github.com/fsgo/go_fmt\n\n[[Rules.Pre]]               \nMatch = \"^add\\\\s\"\n# find file \"go.mod\" and exec \"staticcheck ./...\" in the dir\nCmd   = \"inner:find-exec\"\nArgs  = [\"-name\",\"go.mod\",\"staticcheck\",\"./...\"]\nAllowFail = true        # allow cmd fail\n```\n\n### 3.3 Inner Cmd\n#### inner:find-exec\nFind a filename and execute a command in the directory.\nSkip directories named `node_modules`,`temp` or `tmp`, or those whose names start with `.` or `_`.\n```bash\nUsage of inner:find-exec:\n  -root string\n       search up root dir(default \"go.mod,.git\")\n  -name string\n    \tfind file name (default \"go.mod\")\n  -e\tname as regular expression( default false)\n  -dir_not string\n    \tnot in these dir names, multiple are connected with \",\"\n```\n\nExamples:\n```\n# exec: gorgeous (https://github.com/fsgo/go_fmt)\ninner:find-exec -name go.mod gorgeous\n\n# exec: staticcheck ./...\ninner:find-exec -name go.mod staticcheck ./...\n```\n\n#### inner:git-am\nfind git modified or untracked files\n```bash\nUsage of inner:git-am:\n  -name string\n    \tfind file name (default \"go.mod\")\n  -e\tname as regular expression( default false)\n```\n\nExamples:\n```\ninner:git-am -name \"\\.(css|js)$\" -e dos2unix \"{name}\"\n```\n\n### 3.4 Condition\nWhen `Cond` success, exec `Cmd`.\n```toml\n[[Rules.Pre]]               \nMatch = \"^add\\\\s\"       # when exec \"git add\" subCommand\nCond  = [\"go_module\"]   # condition: in go module dir\nCmd   = \"gorgeous\"      # https://github.com/fsgo/go_fmt\n```\n| Condition                     | Note                                         |\n|-------------------------------|----------------------------------------------|\n| `go_module`                   | in Go module dir, with a file named \"go.mod\" |\n| `has_file` xyz                | in some dirs with a file named \"xyz\"         | \n| `not_has_file` xyz            | in some dirs without a file named \"xyz\"      | \n| `not_has_file` xyz            | in some dirs without a file named \"xyz\"      | \n| `exec` xyz.sh                 | exec command success                         | \n| `in_dir` xyz/abc[;dir2]       | in \"xyz/abc\" dir or in \"dir2\"                | \n| `not_in_dir` xyz/abc[;dir2]   | not in \"xyz/abc\" and \"dir2\" dir              | \n| `git_status_change` .go[,.js] | modified or untracked files of these types   | \n\n\n### 3.5 Eval\neval command without links.\n```bash\nbas git st\n```\nit will eval `git st` command and also execute pre-hooks and post-hooks which defined\nin config file （e.g. `~/.config/bas/git.toml` or `.bas/git.toml`）.\n\n### 3.6 Disable Hooks\nwith env \"BAS_NoHook=true\" or \"bas=off\" or \"bas=no\" to disable Pre-Hooks and Post-Hooks","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffsgo%2Fbin-auto-switcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffsgo%2Fbin-auto-switcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffsgo%2Fbin-auto-switcher/lists"}