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.
#[ cfg( not( feature = "no_std" ) ) ]
{
use wca::*;
let ca = CommandsAggregator::former()
.grammar(
[
Command::former()
.phrase( "echo" )
.hint( "prints all subjects and properties" )
.subject( "Subject", Type::String )
.property( "property", "simple property", Type::String )
.form(),
])
.executor(
[
( "echo".to_owned(), Routine::new( |( args, props )|
{
println!( "= Args\n{args:?}\n\n= Properties\n{props:?}\n" );
Ok( () )
})),
])
.build();
let args = std::env::args().skip( 1 ).collect::< Vec< String > >();
ca.perform( args.join( " " ) ).unwrap();
}
cargo add wca
git clone https://github.com/Wandalen/wTools
cd wTools
cd examples/wca_trivial
cargo run