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/command.go | |
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/command.go')
-rw-r--r-- | vendor/github.com/mitchellh/cli/command.go | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/vendor/github.com/mitchellh/cli/command.go b/vendor/github.com/mitchellh/cli/command.go new file mode 100644 index 0000000..bed11fa --- /dev/null +++ b/vendor/github.com/mitchellh/cli/command.go | |||
@@ -0,0 +1,67 @@ | |||
1 | package cli | ||
2 | |||
3 | import ( | ||
4 | "github.com/posener/complete" | ||
5 | ) | ||
6 | |||
7 | const ( | ||
8 | // RunResultHelp is a value that can be returned from Run to signal | ||
9 | // to the CLI to render the help output. | ||
10 | RunResultHelp = -18511 | ||
11 | ) | ||
12 | |||
13 | // A command is a runnable sub-command of a CLI. | ||
14 | type Command interface { | ||
15 | // Help should return long-form help text that includes the command-line | ||
16 | // usage, a brief few sentences explaining the function of the command, | ||
17 | // and the complete list of flags the command accepts. | ||
18 | Help() string | ||
19 | |||
20 | // Run should run the actual command with the given CLI instance and | ||
21 | // command-line arguments. It should return the exit status when it is | ||
22 | // finished. | ||
23 | // | ||
24 | // There are a handful of special exit codes this can return documented | ||
25 | // above that change behavior. | ||
26 | Run(args []string) int | ||
27 | |||
28 | // Synopsis should return a one-line, short synopsis of the command. | ||
29 | // This should be less than 50 characters ideally. | ||
30 | Synopsis() string | ||
31 | } | ||
32 | |||
33 | // CommandAutocomplete is an extension of Command that enables fine-grained | ||
34 | // autocompletion. Subcommand autocompletion will work even if this interface | ||
35 | // is not implemented. By implementing this interface, more advanced | ||
36 | // autocompletion is enabled. | ||
37 | type CommandAutocomplete interface { | ||
38 | // AutocompleteArgs returns the argument predictor for this command. | ||
39 | // If argument completion is not supported, this should return | ||
40 | // complete.PredictNothing. | ||
41 | AutocompleteArgs() complete.Predictor | ||
42 | |||
43 | // AutocompleteFlags returns a mapping of supported flags and autocomplete | ||
44 | // options for this command. The map key for the Flags map should be the | ||
45 | // complete flag such as "-foo" or "--foo". | ||
46 | AutocompleteFlags() complete.Flags | ||
47 | } | ||
48 | |||
49 | // CommandHelpTemplate is an extension of Command that also has a function | ||
50 | // for returning a template for the help rather than the help itself. In | ||
51 | // this scenario, both Help and HelpTemplate should be implemented. | ||
52 | // | ||
53 | // If CommandHelpTemplate isn't implemented, the Help is output as-is. | ||
54 | type CommandHelpTemplate interface { | ||
55 | // HelpTemplate is the template in text/template format to use for | ||
56 | // displaying the Help. The keys available are: | ||
57 | // | ||
58 | // * ".Help" - The help text itself | ||
59 | // * ".Subcommands" | ||
60 | // | ||
61 | HelpTemplate() string | ||
62 | } | ||
63 | |||
64 | // CommandFactory is a type of function that is a factory for commands. | ||
65 | // We need a factory because we may need to setup some state on the | ||
66 | // struct that implements the command itself. | ||
67 | type CommandFactory func() (Command, error) | ||