use std::path::PathBuf;
use clap::Parser;
use crate::output::OutputFormat;
#[derive(Debug, Clone, Parser)]
#[command(
name = "annotui",
version,
about = "Comment on files and piped text in a mouse-first terminal UI"
)]
pub struct Cli {
#[arg(value_name = "FILE", conflicts_with = "buffer")]
pub input: Option<PathBuf>,
#[arg(long, value_name = "TEXT", conflicts_with = "input")]
pub buffer: Option<String>,
#[arg(long, value_name = "NAME")]
pub source_name: Option<String>,
#[arg(long, value_name = "PATH")]
pub comments: Option<PathBuf>,
#[arg(long, value_enum, default_value_t)]
pub format: OutputFormat,
#[arg(short, long, value_name = "PATH")]
pub output: Option<PathBuf>,
#[arg(long)]
pub no_mouse: bool,
}
#[cfg(test)]
mod tests {
use clap::Parser;
use super::*;
#[test]
fn comments_is_the_default_format() {
let cli = Cli::try_parse_from(["annotui", "input.txt"]).unwrap();
assert_eq!(cli.format, OutputFormat::Comments);
}
#[test]
fn buffer_conflicts_with_a_file() {
assert!(Cli::try_parse_from(["annotui", "input.txt", "--buffer", "hello"]).is_err());
}
}