All languages

Go for DevOps

You're viewing a free preview. Sign in free to read every script.

Why this exists Kubernetes' kubectl, docker, terraform, git and gh all share one shape: tool [global flags] COMMAND [command flags] [arguments]. The existing Command Line Tool page shows a single command with flags,…

Go for DevOps: A Subcommand CLI with the flag Package, Environment Defaults, Repeatable Flags and Exit Codes

Build a tool with subcommands (add, list, remove, version) using only the standard library: one FlagSet per command, defaults from the environment, a repeatable -tag flag, a run function that returns the exit status, and the flag-ordering rule that surprises every newcomer.

Sign in free to read this script, along with the rest of the library.

Sign in free