diff --git a/src/main.rs b/src/main.rs index 1320aa2..b07e814 100644 --- a/src/main.rs +++ b/src/main.rs @@ -170,7 +170,7 @@ Commands: import FILE [FILE...] Import markdown file(s) into the store export [FILE|--all] Export store nodes to markdown file(s) journal-write TEXT Write a journal entry to the store - journal-tail [N] Show last N journal entries (default 20)"); + journal-tail [N] [--full] Show last N journal entries (default 20, --full for content)"); } fn cmd_search(args: &[String]) -> Result<(), String> { @@ -1178,9 +1178,15 @@ fn cmd_journal_write(args: &[String]) -> Result<(), String> { } fn cmd_journal_tail(args: &[String]) -> Result<(), String> { - let n: usize = args.first() - .and_then(|a| a.parse().ok()) - .unwrap_or(20); + let mut n: usize = 20; + let mut full = false; + for arg in args { + if arg == "--full" || arg == "-f" { + full = true; + } else if let Ok(num) = arg.parse::() { + n = num; + } + } let store = capnp_store::Store::load()?; @@ -1248,7 +1254,11 @@ fn cmd_journal_tail(args: &[String]) -> Result<(), String> { if title.is_empty() { title = node.key.clone(); } - println!("[{}] {}", ts, title); + if full { + println!("--- [{}] {} ---\n{}\n", ts, title, node.content); + } else { + println!("[{}] {}", ts, title); + } } Ok(())