macro_rules! lightcli_adv {
($cli:expr, $cmd:ident, $key:ident, $val:ident, [
$(
$cmdv:pat => [
$( $keyv:pat => $action:expr ),*
] => $done:expr
);*
], $nomatch1:expr, $nomatch2:expr, $nomatch3:expr) => { ... };
}Expand description
This macro allows for an easy way to define key value commands while still allowing to define custom error handlers.
§Arguments
$cli: TheLightCliInputinstance to parse data from.$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$valfor the given command and key.$done: What to do when the command is complete.$nomatch1: What to do when the command value is not found while trying to find a key action.$nomatch2: What to do when the key value is not found while trying to find a key action.$nomatch3: What to do when the command value is not found while trying to execute a command.
§Remarks
For a simpler way to write a command see the macro [lightcli!].
This macro makes use of the underlying function parse_data.