entomologist/src/bin/ent/main.rs
2025-07-04 00:42:58 -06:00

48 lines
1.1 KiB
Rust

use clap::Parser;
#[derive(Debug, clap::Parser)]
#[command(version, about, long_about = None)]
struct Args {
/// Directory containing issues.
#[arg(short, long)]
issues_dir: String,
/// Type of behavior/output.
#[command(subcommand)]
command: Commands,
}
#[derive(clap::Subcommand, Debug)]
enum Commands {
/// List issues.
List,
/// Create a new issue.
New {
title: Option<String>,
description: Option<String>,
},
}
fn main() -> anyhow::Result<()> {
let args: Args = Args::parse();
// println!("{:?}", args);
match args.command {
Commands::List => {
let issues =
entomologist::issues::Issues::new_from_dir(std::path::Path::new(&args.issues_dir))?;
for (uuid, issue) in issues.issues.iter() {
println!("{} {} ({:?})", uuid, issue.title, issue.state);
}
}
Commands::New { title, description } => {
println!(
"should make a new issue, title={:?}, description={:?}",
title, description
);
}
}
Ok(())
}