A command-line framework structures console applications around command routing, help text, subcommands, flags, and shell autocompletion. It replaces repeated flag and parser boilerplate with an opinionated application structure. section 2.1.4
Cobra wraps application logic in a cobra.Command, defines command metadata and handlers, and adds short and long flags. The same structure can grow from one action into commands and subcommands. Cobra and cli are prominent alternatives; both build on patterns compatible with Go's standard flag package. section 2.1.4
Hello World and calculator commands
A Cobra application can print "Hello World!" by default, accept --name or -n, display generated help, and add language selection. A calculator extends the pattern with add, sub, mul, and div commands that parse two arguments and return an operation result.
