pub async fn cmd(task_args: TaskArgs) -> Result<()>Expand description
Main entry point for the comprehensive task management command.
This function serves as a large dispatcher that handles the various task management operations based on provided command-line flags. It supports everything from simple task creation to complex batch operations and external service integrations.
§Operation Modes
The function handles these primary modes:
- Deletion Operations: Remove tasks individually or in bulk
- Editing Operations: Modify existing tasks individually or in batches
- Template Operations: Create tasks from predefined templates
- Display Operations: Show tasks with various filtering options
- Discovery Operations: Find and import tasks from multiple sources
- Creation Operations: Create new tasks manually or interactively
§External Integrations
When find mode is activated, the function integrates with:
- GitLab API: Fetches today’s commits as potential completed tasks
- Jira API: Retrieves completed issues for the current day
- Local Database: Finds incomplete tasks that can be continued
§Safety Features
Destructive operations include multiple safety measures:
- Preview of changes before applying
- Multiple confirmation prompts for bulk operations
- Detailed information about affected items
- Option to cancel operations at multiple points
§Arguments
task_args- Parsed command-line arguments specifying the operation to perform
§Returns
Returns Ok(()) on successful operation completion, or an error if the
requested operation fails due to validation, database, or network issues.
§Examples
# Create a simple task
kasl task --name "Review pull request" --completeness 0
# Create task with tags
kasl task --name "Fix login bug" --tags "urgent,backend,bug"
# Find and import tasks from external sources
kasl task --find
# Show all tasks with specific tag
kasl task --show --tag urgent
# Edit multiple tasks interactively
kasl task --edit-interactive
# Create task from template
kasl task --template daily-standup
# Delete specific tasks (with confirmation)
kasl task --delete 1 2 3