journal-tail: add --full flag for complete entry display

`poc-journal tail 5 --full` shows full entry content with
timestamp headers and --- separators. Default mode remains
title-only for scanning. Also passes all args through the
poc-journal wrapper instead of just the count.
This commit is contained in:
ProofOfConcept 2026-03-01 01:43:02 -05:00
parent 6096acb312
commit 515f673251

View file

@ -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::<usize>() {
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(())