rs-xml2selected 0.1.0

Prints the selected part of the xml using xpath.
Documentation
use std::io;
use std::process::ExitCode;

use clap::Parser;

use rs_xml2selected::XML_SIZE_LIMIT_DEFAULT;
use rs_xml2selected::stdin2xml2xpath2stdout;

#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
struct Args {
    #[arg(long, default_value_t = XML_SIZE_LIMIT_DEFAULT)]
    max_input_xml_size: u64,

    #[arg(long)]
    xpath: String,
}

fn sub() -> Result<(), io::Error> {
    let args = Args::parse();
    stdin2xml2xpath2stdout(args.max_input_xml_size, &args.xpath)
}

fn main() -> ExitCode {
    sub().map(|_| ExitCode::SUCCESS).unwrap_or_else(|e| {
        eprintln!("{e}");
        ExitCode::FAILURE
    })
}