Files

44 lines
872 B
Rust
Raw Permalink Normal View History

2024-04-10 10:18:28 +02:00
#![allow(dead_code)]
2023-12-13 12:17:41 +01:00
use std::path::PathBuf;
use uutils_args::{Arguments, Options, Value};
#[derive(Value)]
enum Number {
#[value]
One,
#[value]
Two,
#[value]
Three,
}
#[derive(Arguments)]
enum Arg {
/// Give it nothing!
#[arg("-f", "--flag")]
Flag,
// Completion is derived from the `Number` type, through the `Value` trait
/// Give it a number!
#[arg("-n N", "--number=N")]
2024-03-29 14:05:32 +01:00
Number(#[allow(unused)] Number),
2023-12-13 12:17:41 +01:00
// Completion is derived from the `PathBuf` type
/// Give it a path!
#[arg("-p P", "--path=P")]
2024-03-29 14:05:32 +01:00
Path(#[allow(unused)] PathBuf),
2023-12-13 12:17:41 +01:00
}
struct Settings;
impl Options<Arg> for Settings {
2024-03-29 03:32:30 +01:00
fn apply(&mut self, _arg: Arg) -> Result<(), uutils_args::Error> {
2023-12-13 12:17:41 +01:00
panic!("Compile with the 'parse-is-complete' feature!")
}
}
fn main() {
2023-12-19 15:13:12 +01:00
Settings.parse(std::env::args_os()).unwrap();
2023-12-13 12:17:41 +01:00
}