{"id":13410323,"url":"https://github.com/teris-io/cli","last_synced_at":"2026-01-20T12:03:17.798Z","repository":{"id":51819888,"uuid":"92344024","full_name":"teris-io/cli","owner":"teris-io","description":"Simple and complete API for building command line applications in Go","archived":false,"fork":false,"pushed_at":"2021-05-09T19:28:00.000Z","size":36,"stargazers_count":129,"open_issues_count":2,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-07-31T20:42:14.795Z","etag":null,"topics":["cli"],"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/teris-io.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}},"created_at":"2017-05-24T23:07:07.000Z","updated_at":"2024-06-26T14:11:50.000Z","dependencies_parsed_at":"2022-08-23T08:01:58.637Z","dependency_job_id":null,"html_url":"https://github.com/teris-io/cli","commit_stats":null,"previous_names":["silvertern/cli"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/teris-io/cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teris-io%2Fcli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teris-io%2Fcli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teris-io%2Fcli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teris-io%2Fcli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/teris-io","download_url":"https://codeload.github.com/teris-io/cli/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teris-io%2Fcli/sbom","scorecard":{"id":824085,"data":{"date":"2025-08-11","repo":{"name":"github.com/teris-io/cli","commit":"c0636ab10811202a58915c7c7d7cd6dd6f8d34e5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"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":"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":1,"reason":"Found 3/18 approved changesets -- score normalized to 1","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":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":-1,"reason":"no dependencies found","details":null,"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":"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":"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":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 7 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T16:15:55.920Z","repository_id":51819888,"created_at":"2025-08-23T16:15:55.920Z","updated_at":"2025-08-23T16:15:55.920Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28603307,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T12:01:53.233Z","status":"ssl_error","status_checked_at":"2026-01-20T12:01:46.545Z","response_time":117,"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"],"created_at":"2024-07-30T20:01:06.218Z","updated_at":"2026-01-20T12:03:17.775Z","avatar_url":"https://github.com/teris-io.png","language":"Go","readme":"[![Build status][buildimage]][build] [![Coverage][codecovimage]][codecov] [![GoReportCard][cardimage]][card] [![API documentation][docsimage]][docs]\n\n# Simple and complete API for building command line applications in Go\n\nModule `cli` provides a simple, fast and complete API for building command line applications in Go.\nIn contrast to other libraries the emphasis is put on the definition and validation of\npositional arguments, handling of options from all levels in a single block as well as\na minimalistic set of dependencies.\n\nThe core of the module is the command, option and argument parsing logic. After a successful parsing the \ncommand action is evaluated passing a slice of (validated) positional arguments and a map of (validated) options.\nNo more no less.\n\n## Definition\n\n```go\nco := cli.NewCommand(\"checkout\", \"checkout a branch or revision\").\n  WithShortcut(\"co\").\n  WithArg(cli.NewArg(\"revision\", \"branch or revision to checkout\")).\n  WithOption(cli.NewOption(\"branch\", \"Create branch if missing\").WithChar('b').WithType(cli.TypeBool)).\n  WithOption(cli.NewOption(\"upstream\", \"Set upstream for the branch\").WithChar('u').WithType(cli.TypeBool)).\n  WithAction(func(args []string, options map[string]string) int {\n    // do something\n    return 0\n  })\n\nadd := cli.NewCommand(\"add\", \"add a remote\").\n  WithArg(cli.NewArg(\"remote\", \"remote to add\"))\n\nrmt := cli.NewCommand(\"remote\", \"Work with git remotes\").\n  WithCommand(add)\n\napp := cli.New(\"git tool\").\n  WithOption(cli.NewOption(\"verbose\", \"Verbose execution\").WithChar('v').WithType(cli.TypeBool)).\n  WithCommand(co).\n  WithCommand(rmt)\n  // no action attached, just print usage when executed\n\nos.Exit(app.Run(os.Args, os.Stdout))\n```\n\n## Execution\n\nGiven the above definition for a git client, e.g. `gitc`, running `gitc` with no arguments or with `-h` will\nproduce the following output (the exit code will be 1 in the former case, because the action is missing, and 0 in the latter, because help was explicitly requested):\n\n```\ngitc [--verbose]\n\nDescription:\n    git tool\n\nOptions:\n    -v, --verbose   Verbose execution\n\nSub-commands:\n    git checkout    checkout a branch or revision\n    git remote      Work with git remotes\n```\n\nRunning `gitc` with arguments matching e.g. the `checkout` definition, `gitc co -vbu dev` or\n`gitc checkout -v --branch -u dev` will execute the command as expected. Running into a parsing error, e.g.\n by providing an unknown option `gitc co -f dev`, will output a parsing error and a short usage string:\n\n```\nfatal: unknown flag -f\nusage: gitc checkout [--verbose] [--branch] [--upstream] \u003crevision\u003e\n```\n\n\n### License and copyright\n\n\tCopyright (c) 2017. Oleg Sklyar and teris.io. MIT license applies. All rights reserved.\n\n\n[build]: https://travis-ci.org/teris-io/cli\n[buildimage]: https://travis-ci.org/teris-io/cli.svg?branch=master\n\n[codecov]: https://codecov.io/github/teris-io/cli?branch=master\n[codecovimage]: https://codecov.io/github/teris-io/cli/coverage.svg?branch=master\n\n[card]: http://goreportcard.com/report/teris-io/cli\n[cardimage]: https://goreportcard.com/badge/github.com/teris-io/cli\n\n[docs]: https://godoc.org/github.com/teris-io/cli\n[docsimage]: http://img.shields.io/badge/godoc-reference-blue.svg?style=flat\n","funding_links":[],"categories":["Command Line","命令行","命令行工具### 标准 CLI`用于创建一个标准命令行应用程序的库`","Build Automation","命令行工具","\u003cspan id=\"命令行-command-line\"\u003e命令行 Command Line\u003c/span\u003e"],"sub_categories":["Standard CLI","标准CLI","标准 CLI"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteris-io%2Fcli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteris-io%2Fcli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteris-io%2Fcli/lists"}