use std::env;
use std::sync::OnceLock;
pub fn command_args() -> &'static [String] {
static ARGS: OnceLock<Vec<String>> = OnceLock::new();
ARGS.get_or_init(|| {
env::args_os()
.map(|argument| argument.to_string_lossy().into_owned())
.collect()
})
}
pub fn executable_name() -> Option<&'static str> {
static NAME: OnceLock<Option<String>> = OnceLock::new();
NAME.get_or_init(|| {
let executable = env::current_exe().ok()?;
let name = executable.file_name()?;
Some(name.to_string_lossy().into_owned())
})
.as_deref()
}
pub fn command_line() -> &'static str {
static LINE: OnceLock<String> = OnceLock::new();
LINE.get_or_init(|| command_args().join(" "))
}