`streamd daily [YYYYMMDD]` opens the earliest existing daily file (file_type=daily) whose timestamp falls within the target date. If no such file exists it creates `<timestamp>_daily.md` and opens it. Date defaults to today in the repository timezone.
75 lines
1.7 KiB
Rust
75 lines
1.7 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 a task as done
|
|
Done {
|
|
/// Task number to mark as done
|
|
number: 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,
|
|
},
|
|
}
|