2 unstable releases
0.3.1 | Jun 3, 2023 |
---|---|
0.3.0 |
|
0.2.0 | Jun 2, 2023 |
0.1.1 |
|
0.1.0 |
|
#1081 in Text processing
43 downloads per month
15KB
275 lines
Help Crafter
This crate provides simple method for generating help messages for your CLI application.
Quick Start
- command() for chaining commands to build help message
- build() for generate help message
Example
use help_crafter::enums::{DASHED, Parameter};
use help_crafter::HelpMessageBuilder;
let help = HelpMessageBuilder::default()
.command("i", "index", Parameter::NO, "index", DASHED::YES)
.command(
"k",
"kill",
Parameter::REQUIRED("sessions_id"),
"the big brown fox jumps over the lazy dog the big brown fox",
DASHED::YES,
)
.command(
"",
"rub",
Parameter::OPTIONAL("something"),
"rub something",
DASHED::NO,
)
.command(
"t",
"",
Parameter::REQUIRED("something"),
"t something",
DASHED::YES,
)
.command(
"o",
"",
Parameter::OPTIONAL("something"),
"o something",
DASHED::NO,
)
.build();
lib.rs
:
Help Crafter
This crate provides simple method for generating help messages for your CLI application.
Quick Start
Example
use help_crafter::enums::{DASHED, Parameter};
use help_crafter::HelpMessageBuilder;
let help = HelpMessageBuilder::default()
.command("i", "index", Parameter::NO, "index", DASHED::YES)
.command(
"k",
"kill",
Parameter::REQUIRED("sessions_id"),
"the big brown fox jumps over the lazy dog the big brown fox",
DASHED::YES,
)
.command(
"",
"rub",
Parameter::OPTIONAL("something"),
"rub something",
DASHED::NO,
)
.command(
"t",
"",
Parameter::REQUIRED("something"),
"t something",
DASHED::YES,
)
.command(
"o",
"",
Parameter::OPTIONAL("something"),
"o something",
DASHED::NO,
)
.build();
Returns following message.
-i --index index
-k --kill <sessions_id> the big brown fox jumps over the lazy
dog the big brown fox
rub [something] rub something
-t <something> t something
o [something] o something