Skip to main content

cmd

Function cmd 

Source
pub fn cmd(args: TemplateArgs) -> Result<()>
Expand description

Executes template management operations based on the specified subcommand.

This function serves as the main dispatcher for template operations, routing to appropriate handlers based on user input. When no subcommand is provided, it enters interactive mode for operation selection.

§Operation Routing

  • Create: Template creation with validation and uniqueness checking
  • List: Formatted display of all available templates
  • Edit: Interactive or direct template modification
  • Delete: Safe template removal with confirmation
  • Search: Text-based template discovery
  • Interactive: Menu-driven operation selection when no subcommand given

§Arguments

  • args - Parsed command-line arguments containing operation specification

§Returns

Returns Ok(()) on successful operation completion, or an error if the requested operation fails due to validation, database, or user input issues.

§Examples

# Create a new template interactively
kasl template add

# Create template with specific name
kasl template add --name daily-standup

# List all templates
kasl template list

# Edit a template
kasl template edit daily-standup

# Search for templates
kasl template search meeting

# Interactive mode
kasl template