injm 0.5.1

A CLI tool that injects content into marked regions in source files.
use clap::{Args, Parser, Subcommand};

use crate::output::OutputFormat;

#[derive(Parser)]
#[command(
    name = "injm",
    about = "Inject stdin content into marked regions between `injm begin` and `injm end` comments.",
    version
)]
pub struct Cli {
    #[command(subcommand)]
    pub command: Commands,
}

#[derive(Subcommand)]
pub enum Commands {
    Inject(InjectArgs),
    List(ListArgs),
}

#[derive(Args)]
pub struct InjectArgs {
    #[arg(short, long, num_args = 1..)]
    pub input: Vec<String>,

    #[arg(short, long, num_args = 1..)]
    pub output: Vec<String>,

    #[arg(long)]
    pub dry_run: bool,

    #[arg(long)]
    pub id: Vec<Option<String>>,
}

#[derive(Args)]
pub struct ListArgs {
    #[arg(num_args=1..)]
    pub input: Vec<String>,

    #[arg(long, short, default_value = "table")]
    pub format: OutputFormat,
}