use std::io;

use clap::Parser;
use repo2markdown::fence_wrapper::wrap_in_fence;

/// Wrap stdin in a Markdown fenced code block.
#[derive(Debug, Parser)]
#[command(version, about, long_about = None)]
struct Cli {
    /// Language tag to append to the opening markdown fence.
    #[arg(long, short, default_value = "")]
    language: String,
}

fn main() -> io::Result<()> {
    let cli = Cli::parse();

    let stdin = io::stdin();
    let stdout = io::stdout();

    wrap_in_fence(stdin.lock(), stdout.lock(), &cli.language)
}
