An explanatory deep-dive into what happens from the moment app.Run(args) is called to when a command finishes execution. It describes:
- Parsing Phase: how the arguments array is parsed against the configured commands and settings, how Spectre.Console.Cli matches arguments to
CommandSettingsproperties (and provides errors if something is wrong). - Validation Phase: how and when the library calls
Validate()on settings or commands (e.g., does it validate CommandSettings by invoking an optionalValidatemethod on settings class or just the command's override as documented). - Execution Phase: how the appropriate
Commandinstance is constructed (using DI if available), thenExecuteorExecuteAsyncis called. - Post-Execution: handling the result (the int exit code) and any exception propagation or interception.
- Help invocation: mention that if
--helpis detected, the above phases short-circuit to display help instead of executing a command. This explanation might include a simple flow diagram or description: Input args -> Parser selects Command -> Settings populated -> If parse errors, show error/help -> If ok, create Command -> (Interceptor before) -> Execute -> (Interceptor after) -> return exit code. By understanding this flow, users can reason about behaviors like why their code inExecutemight not run (e.g. if parsing failed or validation failed first).