Command wrappers for cargo xtask pattern
[!IMPORTANT]
This is a work in progress, nothing is guaranteed (yet)
Usage
The main idea is to define commands one of the following ways:
- Single/double dash specifier on arguments
use std::ffi::OsStr;
#[command]
struct Echo {
#[arg(single)]
n: bool,
#[arg(single)]
e: bool,
#[arg(double)]
help: bool,
#[arg(double)]
version:bool,
string: OsStr,
}
- Specifier for everything, sensible defaults
- Defaults:
prefix="--"
postfix=" "
name=IDENT
flag is absent
- Example:
use std::ffi::OsStr;
#[cmd(name="/bin/echo")]
struct Echo {
#[cmd::opt(flag, prefix="-", name="n")]
no_newline: bool,
#[cmd::opt(flag, prefix="-", name="e")]
escape: bool,
#[cmd::opt(flag, prefix="--")]
help: bool,
#[cmd::opt(flag, prefix="--")]
version: bool,
string: OsStr,
}
- Result:
/bin/echo [-n] [-e] [--help] [--version] STRING