-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* init man generator * authors works! * clean up author list * slightly better examples * chaining API * exit status * flags * brush up example * options * add arguments * environment * derive clone
- Loading branch information
1 parent
fc11e37
commit a6271b8
Showing
10 changed files
with
460 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
extern crate man; | ||
|
||
use man::Man; | ||
|
||
fn main() { | ||
let msg = Man::new("auth-service") | ||
.description("authorize & authenticate members") | ||
.argument("path".into()) | ||
.environment( | ||
"PORT".into(), | ||
None, | ||
Some("The network port to listen to.".into()), | ||
) | ||
.flag( | ||
Some("-h".into()), | ||
Some("--help".into()), | ||
Some("Prints help information.".into()), | ||
) | ||
.flag( | ||
Some("-V".into()), | ||
Some("--version".into()), | ||
Some("Prints version information.".into()), | ||
) | ||
.flag( | ||
Some("-v".into()), | ||
Some("--verbosity".into()), | ||
Some("Pass multiple times to print more information.".into()), | ||
) | ||
.option( | ||
Some("-a".into()), | ||
Some("--address".into()), | ||
Some("The network address to listen to.".into()), | ||
"address".into(), | ||
Some("127.0.0.1".into()), | ||
) | ||
.option( | ||
Some("-p".into()), | ||
Some("--port".into()), | ||
Some("The network port to listen to.".into()), | ||
"port".into(), | ||
None, | ||
) | ||
.author("Alice Person", Some("[email protected]".into())) | ||
.author("Bob Human", Some("[email protected]".into())) | ||
.render(); | ||
// .option(Some("-o"), Some("--output"), "output", None, "Output file"); | ||
|
||
println!("{}", msg); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/// An author entry. | ||
#[derive(Debug, Clone)] | ||
pub struct Author { | ||
pub(crate) name: String, | ||
pub(crate) email: Option<String>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/// Command line environment variable representation. | ||
#[derive(Debug, Clone)] | ||
pub struct Env { | ||
pub(crate) name: String, | ||
pub(crate) default: Option<String>, | ||
pub(crate) description: Option<String>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/// Command line flag representation. | ||
#[derive(Debug, Clone)] | ||
pub struct Flag { | ||
pub(crate) short: Option<String>, | ||
pub(crate) long: Option<String>, | ||
pub(crate) description: Option<String>, | ||
} |
Oops, something went wrong.