mod commands;
use anyhow::Result;
use clap::{Parser, Subcommand};
use std::path::PathBuf;
#[derive(Parser)]
#[command(name = "archelon", about = "Markdown-based task and note manager", version)]
struct Cli {
#[arg(long, env = "ARCHELON_JOURNAL_DIR", global = true, value_name = "DIR")]
journal_dir: Option<PathBuf>,
#[command(subcommand)]
command: Command,
}
#[derive(Subcommand)]
enum Command {
Init {
path: Option<PathBuf>,
},
Entry {
#[command(subcommand)]
action: commands::entry::EntryCommand,
},
Cache {
#[command(subcommand)]
action: commands::cache::CacheCommand,
},
Mcp
}
fn main() -> Result<()> {
let cli = Cli::parse();
match cli.command {
Command::Init { path } => commands::init::run(path)?,
Command::Entry { action } => commands::entry::run(cli.journal_dir.as_deref(), action)?,
Command::Cache { action } => commands::cache::run(cli.journal_dir.as_deref(), action)?,
Command::Mcp => commands::mcp::run(cli.journal_dir.as_deref())?,
}
Ok(())
}