{"id":"cobra","name":"Cobra","category":"cli","modulePath":"github.com/spf13/cobra","importPath":"github.com/spf13/cobra","summary":"Command trees, flags and shell completion for CLI applications","capabilities":["subcommands","flags"],"tradeoffs":["Configuration-file loading is a separate concern."],"standardLibrary":false,"source":{"url":"https://github.com/spf13/cobra","kind":"editorial summary of maintainer documentation","reviewedAt":"2026-09-30"},"metadata":{"version":"v1.10.2","goVersion":"1.15","licenses":["Apache-2.0"],"dependencies":[{"path":"github.com/cpuguy83/go-md2man/v2","version":"v2.0.6"},{"path":"github.com/inconshreveable/mousetrap","version":"v1.1.0"},{"path":"github.com/spf13/pflag","version":"v1.0.9"},{"path":"go.yaml.in/yaml/v3","version":"v3.0.4"}],"goMod":"module github.com/spf13/cobra\n\ngo 1.15\n\nrequire (\n\tgithub.com/cpuguy83/go-md2man/v2 v2.0.6\n\tgithub.com/inconshreveable/mousetrap v1.1.0\n\tgithub.com/spf13/pflag v1.0.9\n\tgo.yaml.in/yaml/v3 v3.0.4\n)\n","fetchedAt":"2026-09-30T18:11:16.669Z","sourceUrls":["https://proxy.golang.org/github.com/spf13/cobra/@latest","https://proxy.golang.org/github.com/spf13/cobra/@v/v1.10.2.mod","https://api.deps.dev/v3/systems/go/packages/github.com%2Fspf13%2Fcobra/versions/v1.10.2"],"vulnerabilities":{"status":"checked","ids":[],"checkedAt":"2026-09-30T18:11:16.669Z","source":"https://api.deps.dev/v3/systems/go/packages/github.com%2Fspf13%2Fcobra/versions/v1.10.2"},"freshness":"current"},"example":{"id":"cobra","code":"package main\n\nimport (\n    \"fmt\"\n    \"log\"\n    \"github.com/spf13/cobra\"\n)\n\nfunc main() {\n    var name string\n    command := &cobra.Command{\n        Use: \"hello\",\n        RunE: func(cmd *cobra.Command, args []string) error {\n            _, err := fmt.Fprintln(cmd.OutOrStdout(), \"hello\", name)\n            return err\n        },\n    }\n    command.Flags().StringVar(&name, \"name\", \"Go\", \"Name to greet\")\n    if err := command.Execute(); err != nil {\n        log.Fatal(err)\n    }\n}\n","packageVersion":"v1.10.2","goVersion":"go1.27.1","verification":{"status":"passed","checkedAt":"2026-09-30T18:16:20.347Z","targets":["linux/amd64","windows/amd64"],"cgoEnabled":false},"notes":["Compile verification covers this example only. It does not test runtime behavior or every optional feature."],"goMod":"module example.com/discovery/cobra\n\ngo 1.27.1\n\nrequire github.com/spf13/cobra v1.10.2\n\nrequire (\n\tgithub.com/inconshreveable/mousetrap v1.1.0 // indirect\n\tgithub.com/spf13/pflag v1.0.9 // indirect\n)\n","goSum":"github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=\ngithub.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=\ngithub.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=\ngithub.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=\ngithub.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=\ngithub.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=\ngithub.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY=\ngithub.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=\ngo.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=\ngopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=\n"}}