pong_default/
pong_default.rs

1use std::borrow::Borrow;
2use std::collections::HashMap;
3use std::env::Args;
4use std::rc::Rc;
5use rusty_cli::command_handler::CommandHandlerArguments;
6use rusty_cli::commands::command::Command;
7use rusty_cli::flags::flag::Flags;
8use rusty_cli::runner::Runner;
9
10// is executed on ping
11fn executor(flags: Flags) {
12    println!("Pong");
13}
14
15fn main() {
16
17    // defines the base command
18    let pong_command = Command::new(
19        "Pong".to_string(),
20        "Pong command".to_string(),
21        "usage".to_string(),
22        executor,
23        "ping".to_string()
24    );
25
26    let mut runner = Runner::new();
27    runner.enable_command_handler(CommandHandlerArguments {
28        commands: vec![pong_command],
29        default_no_argument_callback: None,
30        flags: vec![]
31    });
32     runner.run();
33}