<!-- {{# generate.module_header{} #}} -->
# Module :: wca
<!--{ generate.module_header.start() }-->
[](https://github.com/emersion/stability-badges#experimental) [](https://github.com/Wandalen/wTools/actions/workflows/module_wca_push.yml) [](https://docs.rs/wca) [](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fmove%2Fwca%2Fexamples%2Fwca_trivial.rs,RUN_POSTFIX=--example%20module%2Fmove%2Fwca%2Fexamples%2Fwca_trivial.rs/https://github.com/Wandalen/wTools) [](https://discord.gg/m3YfbXpUUY)
<!--{ generate.module_header.end }-->
The tool to make CLI ( commands user interface ). It is able to aggregate external binary applications, as well as functions, which are written in your language.
## Sample
<!-- {{# generate.module{} #}} -->
```rust
#[ cfg( not( feature = "no_std" ) ) ]
{
use wca::{ VerifiedCommand, Type };
fn main()
{
let ca = wca::CommandsAggregator::former()
.command( "echo" )
.hint( "prints all subjects and properties" )
.subject().hint( "Subject" ).kind( Type::String ).optional( true ).end()
.property( "property" ).hint( "simple property" ).kind( Type::String ).optional( true ).end()
.routine( | o : VerifiedCommand | { println!( "= Args\n{:?}\n\n= Properties\n{:?}\n", o.args, o.props ) } )
.end()
.command( "error" )
.hint( "prints all subjects and properties" )
.subject().hint( "Error message" ).kind( Type::String ).optional( true ).end()
.routine( | o : VerifiedCommand | { println!( "Returns an error" ); Err( format!( "{}", o.args.get_owned::< String >( 0 ).unwrap_or_default() ) ) } )
.end()
.command( "exit" )
.hint( "just exit" )
.routine( || { println!( "exit" ); std::process::exit( 0 ) } )
.end()
.perform();
let args: Vec< String > = std::env::args().skip( 1 ).collect();
ca.perform( args ).unwrap();
}
}
```
### To add to your project
```sh
cargo add wca
```
### Try out from the repository
```sh
git clone https://github.com/Wandalen/wTools
cd wTools
cd examples/wca_trivial
cargo run
```