Dependencies, conflicts, and subset propagation.
Relations model command schemas declaratively:
Relation Evaluation Phases | |
| enum | arg_relation_phase { ARG_RELATION_PARSE , ARG_RELATION_VALIDATE_ALWAYS , ARG_RELATION_VALIDATE_SET , ARG_RELATION_VALIDATE_UNSET } |
| Relation evaluation phase used by ARG_DEPENDS and ARG_CONFLICTS. More... | |
Referencing Arguments | |
| #define | ARG(name) |
Returns the address of argument object name. | |
| #define | ARG_DECLARE(name) |
| Forward declares an argument for same-file forward references. | |
| #define | ARG_EXTERN(name) |
| Extern declaration for an argument defined in another file. | |
Relation Declarations | |
| #define | ARG_DEPENDS(relation_phase, ...) |
| Declares dependency relations for an argument. | |
| #define | ARG_CONFLICTS(relation_phase, ...) |
| Declares conflict relations for an argument. | |
| #define | ARG_SUBSETS(...) |
| Declares subset arguments triggered by a parent argument. | |
| #define | ARG_SUBSTRINGS(...) |
| Supplies index-aligned custom strings for subset processing. | |
| #define | ARG_SUBPASS |
| Special marker meaning "forward parent string to subset parser". | |
Cross-File Execution Ordering | |
Deterministic ordering controls for help/validate/action lists. | |
| #define | ARG_ORDER_FIRST |
| Place argument first in the selected ordered list. | |
| #define | ARG_ORDER_AFTER(arg) |
| Place argument immediately after another argument. | |
| #define ARG | ( | name | ) |
| #define ARG_DECLARE | ( | name | ) |
Forward declares an argument for same-file forward references.
Example:
| name | Argument identifier used in ARGUMENT. |
| #define ARG_EXTERN | ( | name | ) |
Extern declaration for an argument defined in another file.
Example:
foo.c
bar.c
| name | Argument identifier used in ARGUMENT. |
| #define ARG_DEPENDS | ( | relation_phase, | |
| ... ) |
Declares dependency relations for an argument.
When setting this argument, all dependencies must already be set. Use inside an ARGUMENT definition.
Example:
| relation_phase | When to check dependencies, see arg_relation_phase. |
| ... | A list of ARG macros with ARGUMENT names. |
| #define ARG_CONFLICTS | ( | relation_phase, | |
| ... ) |
Declares conflict relations for an argument.
If a conflict argument is set, this one must not be set, overriding ARG_REQUIRED. Use inside an ARGUMENT definition.
Example:
| relation_phase | When to check conflicts, see arg_relation_phase. |
| ... | A list of ARG macros with ARGUMENT names. |
| #define ARG_SUBSETS | ( | ... | ) |
Declares subset arguments triggered by a parent argument.
When this argument is set, all subsets are also processed. Parent string is passed to subset parsers unless customized with ARG_SUBSTRINGS. Use inside an ARGUMENT definition.
Example:
| #define ARG_SUBSTRINGS | ( | ... | ) |
Supplies index-aligned custom strings for subset processing.
Use ARG_SUBPASS to pass parent string, omit entirely if not needed.
| ... | A list of strings or ARG_SUBPASS. |
| #define ARG_SUBPASS |
Special marker meaning "forward parent string to subset parser".
Use in ARG_SUBSTRINGS to indicate that the parent argument's string should be passed to the subset parser instead of a custom string.
| #define ARG_ORDER_FIRST |
Place argument first in the selected ordered list.
Value for argument::validate_order, argument::action_order, or argument::help_order.
| #define ARG_ORDER_AFTER | ( | arg | ) |
Place argument immediately after another argument.
Value for argument::validate_order, argument::action_order, or argument::help_order. Use ARG_DECLARE or ARG_EXTERN to forward-declare the referenced argument.
Example:
| arg | Argument supplied using the ARG macro. |
| enum arg_relation_phase |
Relation evaluation phase used by ARG_DEPENDS and ARG_CONFLICTS.