//! Handles arg parsing use super::*; use std::fmt; mod usage; mod data; /// The name of the process that was invoked #[inline] pub fn prog_name() -> &'static str { lazy_static! { static ref NAME: String = std::env::args().next().unwrap(); } &NAME[..] } /// Print usage pub fn print_usage() { println!(r#"batchtask v{version} - advanced process batching by {author} with <3 (licensed GPL3+)"#, version = env!("CARGO_PKG_VERSION"), author = env!("CARGO_PKG_AUTHORS")); println!(r#" Usage: {prog} [OPTIONS] [TASKS]... Usage: {prog} --help {opts} Compiled with: {features} "#, prog = prog_name(), opts = usage::sections().join("\n").trim(), features = usage::features().join("\n")); } /// Print usage then exit with code 0 #[inline(always)] pub fn usage() -> ! { print_usage(); std::process::exit(0) }