Defining Your CLI
This section covers the fundamental patterns for structuring your command-line application with goopt
. You will learn how to define flags, organize commands, and handle positional arguments using goopt
’s flexible struct-first and programmatic APIs.
Choose a topic to begin:
- Struct Tags Reference: A quick reference guide to all available
goopt:"..."
struct tags. - Command Patterns: Learn different ways to organize your commands and subcommands, from simple flat structures to complex nested hierarchies.
- Flag Patterns: Explore patterns for organizing your flags, including namespacing with nested structs and creating reusable flag groups.
- Positional Arguments: A detailed guide on defining and using arguments that rely on their position in the command line.
- Command Callbacks: Learn how to add behavior to your commands and access parsed data from your logic.