{"id":13410569,"url":"https://github.com/mitchellh/cli","last_synced_at":"2025-09-28T23:30:22.369Z","repository":{"id":11590637,"uuid":"14081448","full_name":"mitchellh/cli","owner":"mitchellh","description":"A Go library for implementing command-line interfaces.","archived":true,"fork":false,"pushed_at":"2024-07-22T20:43:09.000Z","size":182,"stargazers_count":1732,"open_issues_count":7,"forks_count":123,"subscribers_count":25,"default_branch":"main","last_synced_at":"2025-01-11T06:45:36.544Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mitchellh.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":"2013-11-03T06:47:54.000Z","updated_at":"2025-01-08T08:06:05.000Z","dependencies_parsed_at":"2024-09-30T04:30:43.086Z","dependency_job_id":"d4431491-242d-4a4e-986a-18539225fb3a","html_url":"https://github.com/mitchellh/cli","commit_stats":{"total_commits":123,"total_committers":30,"mean_commits":4.1,"dds":0.3902439024390244,"last_synced_commit":"e73bd003a976863797bccc7d5630e83969f20bb8"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fcli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fcli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fcli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fcli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mitchellh","download_url":"https://codeload.github.com/mitchellh/cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234569722,"owners_count":18854133,"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":[],"created_at":"2024-07-30T20:01:07.730Z","updated_at":"2025-09-28T23:30:21.996Z","avatar_url":"https://github.com/mitchellh.png","language":"Go","readme":"\u003ccenter\u003e\n\u003cstrong\u003e🚨 This project is archived. 🚨\u003c/strong\u003e \u003ca href=\"https://gist.github.com/mitchellh/90029601268e59a29e64e55bab1c5bdc\"\u003eLearn More\u003c/a\u003e\n\u003c/center\u003e\n\n\u003chr\u003e \n\n# Go CLI Library [![GoDoc](https://godoc.org/github.com/mitchellh/cli?status.png)](https://pkg.go.dev/github.com/mitchellh/cli)\n\ncli is a library for implementing command-line interfaces in Go.\ncli is the library that powers the CLI for\n[Packer](https://github.com/mitchellh/packer),\n[Consul](https://github.com/hashicorp/consul),\n[Vault](https://github.com/hashicorp/vault),\n[Terraform](https://github.com/hashicorp/terraform),\n[Nomad](https://github.com/hashicorp/nomad), and more.\n\n## Features\n\n* Easy sub-command based CLIs: `cli foo`, `cli bar`, etc.\n\n* Support for nested subcommands such as `cli foo bar`.\n\n* Optional support for default subcommands so `cli` does something\n  other than error.\n\n* Support for shell autocompletion of subcommands, flags, and arguments\n  with callbacks in Go. You don't need to write any shell code.\n\n* Automatic help generation for listing subcommands.\n\n* Automatic help flag recognition of `-h`, `--help`, etc.\n\n* Automatic version flag recognition of `-v`, `--version`.\n\n* Helpers for interacting with the terminal, such as outputting information,\n  asking for input, etc. These are optional, you can always interact with the\n  terminal however you choose.\n\n* Use of Go interfaces/types makes augmenting various parts of the library a\n  piece of cake.\n\n## Example\n\nBelow is a simple example of creating and running a CLI\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/mitchellh/cli\"\n)\n\nfunc main() {\n\tc := cli.NewCLI(\"app\", \"1.0.0\")\n\tc.Args = os.Args[1:]\n\tc.Commands = map[string]cli.CommandFactory{\n\t\t\"foo\": fooCommandFactory,\n\t\t\"bar\": barCommandFactory,\n\t}\n\n\texitStatus, err := c.Run()\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tos.Exit(exitStatus)\n}\n```\n\n","funding_links":[],"categories":["Command Line","命令行","CLI frameworks","Go","命令行工具","\u003cspan id=\"命令行-command-line\"\u003e命令行 Command Line\u003c/span\u003e","命令行工具### 标准 CLI`用于创建一个标准命令行应用程序的库`","Build Automation"],"sub_categories":["Standard CLI","标准CLI","标准 CLI","标准命令行交互","標準命令行交互"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitchellh%2Fcli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmitchellh%2Fcli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitchellh%2Fcli/lists"}