#[cfg(feature = "derive")]
mod derive_test {
use clipv::describe::command::AsCommand;
use clipv::{AsCommand, AsArg};
#[allow(dead_code)]
#[derive(AsCommand)]
enum SimpleEnum {
Variant1,
Variant2,
}
#[test]
fn it_should_display_the_usage() {
assert_eq!(SimpleEnum::help(), r#"description
Usage: SimpleEnum <SimpleEnum>
Arguments:
SimpleEnum
- Variant1
- Variant2provides some documentation
"#);
}
#[derive(Debug,AsArg)]
struct EmptyArg;
#[allow(dead_code)]
#[derive(Debug, AsCommand)]
enum NestedEnum {
Tuple (u8, String),
Struct { a: u8, b: String },
#[group]
SubArg(EmptyArg),
Unit
}
#[test]
fn it_should_support_nested_arguments() {
assert_eq!(NestedEnum::help(), r#"Usage: NestedEnum <NestedEnum>
Arguments:
NestedEnum
- u8
String
- a
b
- EmptyArg
- Unit
"#);
}
#[allow(dead_code)]
#[derive(AsCommand)]
#[command]
enum SimpleCommad {
Variant1,
Variant2,
}
}