diff options
author | Alex Pilon <apilon@hashicorp.com> | 2019-02-22 18:24:37 -0500 |
---|---|---|
committer | Alex Pilon <apilon@hashicorp.com> | 2019-02-22 18:24:37 -0500 |
commit | 15c0b25d011f37e7c20aeca9eaf461f78285b8d9 (patch) | |
tree | 255c250a5c9d4801c74092d33b7337d8c14438ff /vendor/github.com/mitchellh/cli/README.md | |
parent | 07971ca38143c5faf951d152fba370ddcbe26ad5 (diff) | |
download | terraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.tar.gz terraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.tar.zst terraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.zip |
deps: github.com/hashicorp/terraform@sdk-v0.11-with-go-modules
Updated via: go get github.com/hashicorp/terraform@sdk-v0.11-with-go-modules and go mod tidy
Diffstat (limited to 'vendor/github.com/mitchellh/cli/README.md')
-rw-r--r-- | vendor/github.com/mitchellh/cli/README.md | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/vendor/github.com/mitchellh/cli/README.md b/vendor/github.com/mitchellh/cli/README.md new file mode 100644 index 0000000..8f02cdd --- /dev/null +++ b/vendor/github.com/mitchellh/cli/README.md | |||
@@ -0,0 +1,67 @@ | |||
1 | # Go CLI Library [![GoDoc](https://godoc.org/github.com/mitchellh/cli?status.png)](https://godoc.org/github.com/mitchellh/cli) | ||
2 | |||
3 | cli is a library for implementing powerful command-line interfaces in Go. | ||
4 | cli is the library that powers the CLI for | ||
5 | [Packer](https://github.com/mitchellh/packer), | ||
6 | [Serf](https://github.com/hashicorp/serf), | ||
7 | [Consul](https://github.com/hashicorp/consul), | ||
8 | [Vault](https://github.com/hashicorp/vault), | ||
9 | [Terraform](https://github.com/hashicorp/terraform), and | ||
10 | [Nomad](https://github.com/hashicorp/nomad). | ||
11 | |||
12 | ## Features | ||
13 | |||
14 | * Easy sub-command based CLIs: `cli foo`, `cli bar`, etc. | ||
15 | |||
16 | * Support for nested subcommands such as `cli foo bar`. | ||
17 | |||
18 | * Optional support for default subcommands so `cli` does something | ||
19 | other than error. | ||
20 | |||
21 | * Support for shell autocompletion of subcommands, flags, and arguments | ||
22 | with callbacks in Go. You don't need to write any shell code. | ||
23 | |||
24 | * Automatic help generation for listing subcommands | ||
25 | |||
26 | * Automatic help flag recognition of `-h`, `--help`, etc. | ||
27 | |||
28 | * Automatic version flag recognition of `-v`, `--version`. | ||
29 | |||
30 | * Helpers for interacting with the terminal, such as outputting information, | ||
31 | asking for input, etc. These are optional, you can always interact with the | ||
32 | terminal however you choose. | ||
33 | |||
34 | * Use of Go interfaces/types makes augmenting various parts of the library a | ||
35 | piece of cake. | ||
36 | |||
37 | ## Example | ||
38 | |||
39 | Below is a simple example of creating and running a CLI | ||
40 | |||
41 | ```go | ||
42 | package main | ||
43 | |||
44 | import ( | ||
45 | "log" | ||
46 | "os" | ||
47 | |||
48 | "github.com/mitchellh/cli" | ||
49 | ) | ||
50 | |||
51 | func main() { | ||
52 | c := cli.NewCLI("app", "1.0.0") | ||
53 | c.Args = os.Args[1:] | ||
54 | c.Commands = map[string]cli.CommandFactory{ | ||
55 | "foo": fooCommandFactory, | ||
56 | "bar": barCommandFactory, | ||
57 | } | ||
58 | |||
59 | exitStatus, err := c.Run() | ||
60 | if err != nil { | ||
61 | log.Println(err) | ||
62 | } | ||
63 | |||
64 | os.Exit(exitStatus) | ||
65 | } | ||
66 | ``` | ||
67 | |||