1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
use clap::{Parser, Subcommand};
fn parse_relative_date(s: &str) -> Result<i64, String> {
s.parse::<i64>().map_err(|_| format!("Invalid relative date: {}", s))
}
#[derive(Parser)]
#[command(name = "journey")]
#[command(about = "A CLI-based journal application")]
#[command(disable_version_flag = true)]
#[command(args_conflicts_with_subcommands = true)]
pub struct Cli {
#[command(subcommand)]
pub command: Option<Commands>,
/// Add a note (default behavior)
#[arg(short, long)]
pub add_note: Option<String>,
/// List notes for a specific date
#[arg(short, long)]
pub list: bool,
/// Edit today's note
#[arg(short, long)]
pub edit: bool,
/// Date selector (YYYY-MM-DD format)
#[arg(short, long)]
pub date: Option<String>,
/// Relative date selector (days offset, 0 = today, positive = past, negative = future)
#[arg(short, long, value_parser = parse_relative_date)]
pub relative_date: Option<i64>,
/// Time selector (HH:MM or HH:MM:SS format)
#[arg(short, long)]
pub time: Option<String>,
/// Time format override (12h|24h)
#[arg(long)]
pub time_format: Option<String>,
/// Read input from stdin (each line becomes a separate note)
#[arg(long)]
pub stdin: bool,
/// Vault name to use (optional if only one vault exists)
#[arg(short = 'V', long)]
pub vault: Option<String>,
/// Category for section selection (e.g., 'work' uses section_header_work)
#[arg(short = 'c', long)]
pub category: Option<String>,
/// Include table headers when listing notes in table format
#[arg(long)]
pub header: bool,
/// Show version information
#[arg(short = 'v', long = "version")]
pub version: bool,
/// Note content (for default behavior)
#[arg(trailing_var_arg = true)]
pub note_content: Vec<String>,
}
#[derive(Subcommand)]
pub enum Commands {
/// Add a note
Add {
/// The note content
content: String,
},
/// List notes
List,
/// Edit notes
Edit,
}