[][src]Attribute Macro commander_macros::direct

#[direct]

Define direct function of CLI

It allows users that don't use sub-command. It can be used directly.

example

This example is not tested
#[direct(<a> <b> [c] [d])]
 fn direct(a: String, b: String) {
     println!("hello! {} {}", a, b);
 }

When you input [pkg-name] 1 2 3, cli will print "hello! 1 2". So it allows you that don't need to define a sub-command anymore in some simple situations.

Format

Only accept arguments, such as #[direct(<a> <b> <c>)].