goopt Guides
Welcome to the goopt documentation guides. This collection provides a comprehensive learning path, from building your first application to mastering advanced features.
Whether you’re a new user or an experienced developer, these guides are designed to help you get the most out of goopt.
Learning Path
We recommend reading the guides in the following order.
1. The Basics
Start here to learn the fundamentals of building a CLI with goopt.
- Getting Started: Build your first application in 5 minutes.
- Core Concepts: Understand the key building blocks and design philosophy of the library.
2. Structuring Your Application
These guides cover the patterns for defining your flags, commands, and arguments.
- Defining Your CLI: An overview of the different ways to structure your application’s interface.
- Struct Tags Reference: A quick reference for all available
goopt:"..."tags. - Command Patterns: Learn to organize commands using nested structs, paths, and programmatic builders.
- Flag Patterns: Explore patterns for namespacing and reusing flag groups.
- Positional Arguments: A detailed guide on position-dependent arguments.
- Command Callbacks: Learn how to attach behavior to your commands.
3. Advanced Features
Dive deeper into the powerful features that make goopt suitable for complex, production-grade applications.
- Advanced Features Overview
- Validation: Ensure data correctness with built-in and custom validators.
- Execution Hooks: Manage the command lifecycle with pre- and post-execution hooks.
- Error Handling: Best practices for robust error handling during setup.
- Flag Inheritance: Understand how flags are resolved in nested command hierarchies.
4. Built-in Functionality
Learn about the powerful “batteries-included” features that come with goopt.
- Built-in Features Overview
- The Help System: Customize the adaptive and interactive help system.
- Version Flag Support: Automatically add a
--versionflag. - Shell Completion: Generate completion scripts for popular shells.
- Environment & External Configuration: Load configuration from environment variables or files.
5. Internationalization (i18n)
A comprehensive guide to creating multi-language CLIs.
- Internationalization Overview
- Tooling:
goopt-i18n-gen: A deep dive into the powerful code generation and workflow tool for i18n.