Trait subcmd::Command
[−]
[src]
pub trait Command { fn name<'a>(&self) -> &'a str; fn help<'a>(&self) -> &'a str; fn description<'a>(&self) -> &'a str; fn run(&self, argv: &Vec<String>); }
This trait must be implemented for each subcommand
Required Methods
fn name<'a>(&self) -> &'a str
This fonction must return the command line, without space. Like
build
, clean
, ...
fn help<'a>(&self) -> &'a str
Return the help message of a subcommand. Used for bin help subcommand
fn description<'a>(&self) -> &'a str
Return a one line description. Used for the program help bin -h
fn run(&self, argv: &Vec<String>)
Main entry point. argv contains all argument passed to the binary, with the program name in argv[0]