streamd/src/cli/args.rs
Konstantin Fickel 4d4118f4ce
All checks were successful
Release / Build and Release (push) Successful in 5s
Continuous Integration / Build Package (push) Successful in 44s
Continuous Integration / Lint, Check & Test (push) Successful in 1m16s
feat: todo done accepts multiple task numbers and prints completed task
- Change `todo done <N>` to variadic `todo done <N>...` for stable
  indices across sequential calls
- Process multiple numbers highest-index-first so lower indices remain
  valid as tasks are removed
- Validate all numbers upfront before mutating any files
- After marking done, print the full task block (same format as list)
  so the user gets visual confirmation of what was completed
- Extract `mark_task_done` as a testable helper; add unit tests
2026-04-24 20:06:32 +02:00

79 lines
1.9 KiB
Rust

use clap::{Parser, Subcommand};
use clap_complete::Shell;
#[derive(Parser)]
#[command(name = "streamd")]
#[command(
author,
version,
about = "Personal knowledge management and time-tracking CLI using @Tag annotations"
)]
pub struct Cli {
#[command(subcommand)]
pub command: Option<Commands>,
}
#[derive(Subcommand)]
pub enum TodoAction {
/// Edit a task by its number
Edit {
/// Task number to edit
number: usize,
},
/// Mark one or more tasks as done
Done {
/// Task numbers to mark as done (processed highest-index-first for stable indices)
#[arg(required = true, num_args = 1..)]
numbers: Vec<usize>,
},
}
#[derive(Subcommand)]
pub enum Commands {
/// Create a new stream file
New,
/// Display open tasks
Todo {
/// Show tasks with dates in the future
#[arg(long)]
show_future: bool,
#[command(subcommand)]
action: Option<TodoAction>,
},
/// Edit a stream file by position
Edit {
/// Position of the file to edit (0 = most recent, negative = from oldest)
#[arg(default_value = "1")]
number: i32,
},
/// Display extracted timesheets
Timesheet {
/// Display time as decimal hours (X.XXh) instead of the default HH:MM format
#[arg(short, long)]
decimal: bool,
/// Show all timecards grouped by day instead of the summary report
#[arg(short, long)]
debug: bool,
},
/// Open or create the daily entry for a given date
Daily {
/// Date in YYYYMMDD format (defaults to today in configured timezone)
date: Option<String>,
},
/// Generate shell completions
Completions {
/// Shell to generate completions for
#[arg(value_enum)]
shell: Shell,
},
/// Start LSP server (communicates over stdin/stdout)
Lsp,
}