pub fn alias_spec() -> CommandSpec {
CommandSpec {
name: "alias".to_string(),
description: "Create or list command aliases".to_string(),
options: Vec::new(),
args: vec![CommandArg {
name: "definition".to_string(),
description: "Alias definition in the form name=value".to_string(),
is_optional: true,
is_variadic: true,
is_command: false,
}],
}
}
#[derive(Debug, Clone)]
pub struct CommandSpec {
pub name: String,
pub description: String,
pub options: Vec<CommandOption>,
pub args: Vec<CommandArg>,
}
#[derive(Debug, Clone)]
pub struct CommandOption {
pub name: Vec<String>,
pub description: String,
pub args: Option<CommandArg>,
}
#[derive(Debug, Clone)]
pub struct CommandArg {
pub name: String,
pub description: String,
pub is_optional: bool,
pub is_variadic: bool,
pub is_command: bool,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_alias_spec() {
let spec = alias_spec();
assert_eq!(spec.name, "alias");
assert!(!spec.args.is_empty());
}
}