39 breaking releases
| new 0.46.0 | Apr 19, 2026 |
|---|---|
| 0.45.0 | Mar 31, 2026 |
| 0.44.0 | Jan 25, 2026 |
| 0.42.0 | Dec 20, 2025 |
| 0.1.0 | Oct 1, 2021 |
#741 in Command-line interface
2,079 downloads per month
Used in 4 crates
(3 directly)
605KB
2.5K
SLoC
Module :: wca
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
#[ 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
cargo add wca
Try out from the repository
git clone https://github.com/Wandalen/wTools
cd wTools
cd examples/wca_trivial
cargo run
Dependencies
~4.5MB
~74K SLoC