tinyflags

Examples

Clone the repository to run the examples against the checked-out source:

git clone https://github.com/containeroo/tinyflags.git
cd tinyflags

Simple

Basic flags, strict booleans and verbosity counters. Source.

go run ./examples/simple --help

Advanced

Sections, slices, defaults and finalizers. Source.

go run ./examples/advanced --help

Commands

Nested commands and inherited globals. Source.

go run ./examples/commands --help

Subsubcommands

Deeper subcommand trees. Source.

go run ./examples/subsubcommands --help

Typedcommands

Typed runners and graceful cancellation. Source.

go run ./examples/typedcommands --help

Dynamic

Dynamic flag groups and per-instance finalizers. Source.

go run ./examples/dynamic --help

Groups

Mutually exclusive and require-together flags. Source.

go run ./examples/groups --help

Toggle

Paired boolean flags and explicit changes. Source.

go run ./examples/toggle --help