#![deny(unsafe_code)]
#![allow(unused)]
mod commands;
mod exit;
use crate::exit::ExitCode;
use clientele::{
StandardOptions,
crates::{
camino::Utf8PathBuf,
clap::{Parser, Subcommand},
},
};
#[derive(Debug, Parser)]
#[command(name = "RDF.rs")]
#[command(arg_required_else_help = true)]
struct Options {
#[clap(flatten)]
flags: StandardOptions,
#[command(subcommand)]
command: Option<Command>,
}
#[derive(Debug, Subcommand)]
enum Command {
Format {
#[command(subcommand)]
command: FormatCommand,
},
Count {
files: Vec<Utf8PathBuf>,
},
Parse {
files: Vec<Utf8PathBuf>,
},
}
#[derive(Debug, Subcommand)]
enum FormatCommand {
List {},
}
pub fn main() -> Result<(), ExitCode> {
clientele::dotenv().ok();
let args = clientele::args_os()?;
let options = Options::parse_from(args);
if options.flags.version {
println!("RDF.rs {}", env!("CARGO_PKG_VERSION"));
return Ok(());
}
if options.flags.license {
println!("This is free and unencumbered software released into the public domain.");
return Ok(());
}
if options.flags.verbose > 0 || options.flags.debug {
}
use commands::*;
match options.command.unwrap() {
Command::Format { command } => match command {
FormatCommand::List {} => format::list::list(&options.flags),
},
Command::Count { files } => count::count(files, &options.flags),
Command::Parse { files } => parse::parse(files, &options.flags),
}
}