We break down a convenient CLI approach: “subcommands instead of a mode flag”. The launch format is
app <cmd> [flags] [args], the dispatcher’s role (routing), extracting the command from
os.Args, minimal routing via
switch, and a scalable option via a
map[
string]
handler table. We also pin down the responsibility boundary: the dispatcher chooses the command, while flags are parsed by the command itself (no global
flag.Parse()), and we improve UX with
usage and clear errors.