pub fn generate_command_tree(spec: &CachedSpec) -> CommandExpand description
Generates a dynamic clap command tree from a cached OpenAPI specification.
This function creates a hierarchical command structure based on the OpenAPI spec:
- Root command: “api” (
CLI_ROOT_COMMAND) - Tag groups: Operations are grouped by their tags (e.g., “users”, “posts”)
- Operations: Individual API operations as subcommands under their tag group
§Arguments
spec- The cachedOpenAPIspecificationexperimental_flags- Whether to use flag-based syntax for all parameters
§Returns
A clap Command configured with all operations from the spec
§Example
For an API with a “users” tag containing “getUser” and “createUser” operations:
api users get-user <args>
api users create-user <args>