dispatch_command

Function dispatch_command 

Source
pub async fn dispatch_command(cli: &Cli) -> Result<()>
Expand description

Dispatches a parsed command to its handler.

This function takes the parsed CLI arguments and routes the command to the appropriate handler function. All handlers are async and return a Result for consistent error handling.

§Arguments

  • cli - The parsed CLI arguments including global options and command

§Returns

Returns Ok(()) if the command executed successfully, or an error if execution failed.

§Errors

Returns an error if:

  • The command handler encounters an error
  • Required resources are not available
  • Configuration is invalid
  • Git operations fail
  • File system operations fail

§Examples

use sublime_cli_tools::cli::{Cli, dispatch_command};
use clap::Parser;

let cli = Cli::parse();
dispatch_command(&cli).await?;