use anyhow::Result;
use clap::{Parser, Subcommand};
mod commands;
mod db;
mod editor;
mod tags;
#[derive(Parser)]
#[command(name = "mind")]
#[command(version)]
#[command(about = "I am your mind, at your command, on the line: your command line mind", long_about = None)]
struct Cli {
#[command(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
enum Commands {
Add {
content: Option<String>,
},
#[command(visible_alias = "ls")]
List {
tag: Option<String>,
},
#[command(visible_alias = "del")]
Delete {
filter: String,
},
}
fn main() -> Result<()> {
let cli = Cli::parse();
match cli.command {
Commands::Add { content } => commands::add_note(content.as_deref())?,
Commands::List { tag } => commands::list_notes(tag.as_deref())?,
Commands::Delete { filter } => commands::delete_notes(&filter)?,
}
Ok(())
}