How barabol/argset works
Argset is a lightweight C command-line argument parsing library. An application initializes an Argset with argc/argv, registers named bool, callback, iterator, and variable arguments (plus aliases), then calls argsetCall to validate and dispatch parsed arguments; it can query bool call counts and free the parser afterward. The README also documents generated help and a default iterator for unclaimed arguments. Excerpts from arg.c are partial, so uncertain internal wiring is omitted.
Main entry points: arg.c Validation and Parse · arg.h Argset API
Components 13
Application API
- Argset API
src/argset/arg.h - Init and Free
src/argset/arg.c
Argument Registry
- Argument Registration
src/argset/arg.c - Name Trie
src/argset/arg.c - Help Listing
src/argset/arg.c
Parse and Dispatch
- Validation and Parse
src/argset/arg.c - Bool Call Counts
src/argset/arg.c - Typed Variable Write
src/argset/arg.c - User Callbacks
src/argset/arg.c
Other components
- Application
- Command-line Args
- Terminal Output
- Application State
Connections 18
- Application → Argset API: uses API
- Application → Init and Free: initializes and frees
- Command-line Args → Init and Free: initializes with
- Application → Argument Registration: registers arguments
- Argument Registration → Name Trie: inserts names
- Argument Registration → Help Listing: adds descriptions
- Application → Validation and Parse: invokes parse
- Validation and Parse → Command-line Args: reads arguments
- Validation and Parse → Name Trie: looks up names
- Validation and Parse → Bool Call Counts: increments count
- Application → Bool Call Counts: queries count
- Validation and Parse → Typed Variable Write: converts and writes
- Typed Variable Write → Application State: updates value
- Validation and Parse → User Callbacks: dispatches callbacks
- User Callbacks → Application State: may update
- Validation and Parse → Terminal Output: reports errors
- Application → Terminal Output: requests help
- Help Listing → Terminal Output: prints descriptions