Skip to content

Latest commit

 

History

History
 
 

wca

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Module :: wca

experimental rust-status docs.rs Open in Gitpod discord

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::*;

    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();
}

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