MCPcopy Create free account
hub / github.com/cloud-native-go/examples / init

Function init

ch10/flags-cobra/main.go:42–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

40}
41
42func init() {
43 flagsCmd.Flags().StringVarP(&strp, "string", "s", "foo", "a string")
44 flagsCmd.Flags().IntVarP(&intp, "number", "n", 42, "an integer")
45 flagsCmd.Flags().BoolVarP(&boolp, "boolean", "b", false, "a boolean")
46
47 rootCmd.AddCommand(flagsCmd)
48}
49
50func flagsFunc(cmd *cobra.Command, args []string) {
51 fmt.Println("string:", strp)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected