Registry / cli / mitchellh-cli

mitchellh-cli

JSON →
library1.1.5gogounverified

A library for implementing command-line interfaces with subcommands and help text.

go get github.com/mitchellh/cli
INSTALL
IMPORT
SIG · MITCHELLH-CLI
M
mitchellh-cli
cligov1.1.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

cli
github.com/mitchellh/cli

Create a CLI with subcommands

package main import ( "github.com/mitchellh/cli" ) func main() { c := cli.NewCLI("app", "1.0.0") c.Args = os.Args[1:] c.Commands = map[string]cli.CommandFactory{ "hello": func() (cli.Command, error) { return &HelloCommand{}, nil }, } exitCode, err := c.Run() if err != nil { panic(err) } os.Exit(exitCode) } type HelloCommand struct{} func (h *HelloCommand) Help() string { return "prints hello" } func (h *HelloCommand) Run(args []string) int { fmt.Println("Hello") return 0 } func (h *HelloCommand) Synopsis() string { return "prints hello" }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
1.1.5latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
10
Resources
mitchellh-cli — go get mitchellh-cli · libregistry