[][src]Macro light_cli::lightcli

macro_rules! lightcli {
    ($cli:expr, $cl_out:expr, $cmd:ident, $key:ident, $val:ident, [ 
        $(
            $cmdv:pat => [
                $( $keyv:pat => $action:expr ),*
            ] => $done:expr
        );*
    ]) => { ... };
}

This macro allows for an easy way to define key value commands.

Arguments

  • $cli: The LightCliInput instance to parse data from.
  • $cl_out: The LightCliOutput instance to write errors to.
  • $cmd: The identifier to use to access the current command.
  • $key: The identifier to use to access the curernt key.
  • $val: The identifier to use to access the curernt value.
  • $cmdv: The name of the command.
  • $keyv: The key for command $cmdv.
  • $action: What to do with the value $val for the given command and key.
  • $done: What to do when the command is complete.

Remarks

For a command that doesn't use the output and allows for custom error handling see the macro lightcli_adv!. This macro makes use of the underlying function parse_data.