pub struct Manual { /* private fields */ }
Expand description
The main man page struct.
Implementations§
Source§impl Manual
impl Manual
Sourcepub fn new(name: &str) -> Self
pub fn new(name: &str) -> Self
Create a new instance.
Examples found in repository?
examples/main.rs (line 6)
5fn main() {
6 let msg = Manual::new("auth-service")
7 .about("authorize & authenticate members")
8 .arg(Arg::new("path"))
9 .env(Env::new("PORT").help("The network port to listen to"))
10 .flag(
11 Flag::new()
12 .short("-h")
13 .long("--help")
14 .help("Prints help information."),
15 )
16 .flag(
17 Flag::new()
18 .short("-V")
19 .long("--version")
20 .help("Prints version information."),
21 )
22 .flag(
23 Flag::new()
24 .short("-v")
25 .long("--verbosity")
26 .help("Pass multiple times to print more information."),
27 )
28 .option(
29 Opt::new("port")
30 .short("-p")
31 .long("--port")
32 .help("The network port to listen to."),
33 )
34 .example(
35 Example::new()
36 .text("listen on port 3000")
37 .command("auth-service -p 3000")
38 .output("now listening on port 3000"),
39 )
40 .example(
41 Example::new()
42 .text("auth-service may need to be run by root")
43 .prompt("#")
44 .command("auth-service"),
45 )
46 .custom(
47 Section::new("custom section")
48 .paragraph("text for the custom section")
49 .paragraph("Additional text for the custom section"),
50 )
51 .author(Author::new("Alice Person").email("alice@person.com"))
52 .author(Author::new("Bob Human").email("bob@human.com"))
53 .render();
54 // .option(Some("-o"), Some("--output"), "output", None, "Output file");
55
56 println!("{}", msg);
57}
Sourcepub fn about<S: Into<String>>(self, about: S) -> Self
pub fn about<S: Into<String>>(self, about: S) -> Self
Add a short description.
Examples found in repository?
examples/main.rs (line 7)
5fn main() {
6 let msg = Manual::new("auth-service")
7 .about("authorize & authenticate members")
8 .arg(Arg::new("path"))
9 .env(Env::new("PORT").help("The network port to listen to"))
10 .flag(
11 Flag::new()
12 .short("-h")
13 .long("--help")
14 .help("Prints help information."),
15 )
16 .flag(
17 Flag::new()
18 .short("-V")
19 .long("--version")
20 .help("Prints version information."),
21 )
22 .flag(
23 Flag::new()
24 .short("-v")
25 .long("--verbosity")
26 .help("Pass multiple times to print more information."),
27 )
28 .option(
29 Opt::new("port")
30 .short("-p")
31 .long("--port")
32 .help("The network port to listen to."),
33 )
34 .example(
35 Example::new()
36 .text("listen on port 3000")
37 .command("auth-service -p 3000")
38 .output("now listening on port 3000"),
39 )
40 .example(
41 Example::new()
42 .text("auth-service may need to be run by root")
43 .prompt("#")
44 .command("auth-service"),
45 )
46 .custom(
47 Section::new("custom section")
48 .paragraph("text for the custom section")
49 .paragraph("Additional text for the custom section"),
50 )
51 .author(Author::new("Alice Person").email("alice@person.com"))
52 .author(Author::new("Bob Human").email("bob@human.com"))
53 .render();
54 // .option(Some("-o"), Some("--output"), "output", None, "Output file");
55
56 println!("{}", msg);
57}
Sourcepub fn description<S: Into<String>>(self, description: S) -> Self
pub fn description<S: Into<String>>(self, description: S) -> Self
Add a long description.
Add an author.
Examples found in repository?
examples/main.rs (line 51)
5fn main() {
6 let msg = Manual::new("auth-service")
7 .about("authorize & authenticate members")
8 .arg(Arg::new("path"))
9 .env(Env::new("PORT").help("The network port to listen to"))
10 .flag(
11 Flag::new()
12 .short("-h")
13 .long("--help")
14 .help("Prints help information."),
15 )
16 .flag(
17 Flag::new()
18 .short("-V")
19 .long("--version")
20 .help("Prints version information."),
21 )
22 .flag(
23 Flag::new()
24 .short("-v")
25 .long("--verbosity")
26 .help("Pass multiple times to print more information."),
27 )
28 .option(
29 Opt::new("port")
30 .short("-p")
31 .long("--port")
32 .help("The network port to listen to."),
33 )
34 .example(
35 Example::new()
36 .text("listen on port 3000")
37 .command("auth-service -p 3000")
38 .output("now listening on port 3000"),
39 )
40 .example(
41 Example::new()
42 .text("auth-service may need to be run by root")
43 .prompt("#")
44 .command("auth-service"),
45 )
46 .custom(
47 Section::new("custom section")
48 .paragraph("text for the custom section")
49 .paragraph("Additional text for the custom section"),
50 )
51 .author(Author::new("Alice Person").email("alice@person.com"))
52 .author(Author::new("Bob Human").email("bob@human.com"))
53 .render();
54 // .option(Some("-o"), Some("--output"), "output", None, "Output file");
55
56 println!("{}", msg);
57}
Sourcepub fn env(self, env: Env) -> Self
pub fn env(self, env: Env) -> Self
Add an environment variable.
Examples found in repository?
examples/main.rs (line 9)
5fn main() {
6 let msg = Manual::new("auth-service")
7 .about("authorize & authenticate members")
8 .arg(Arg::new("path"))
9 .env(Env::new("PORT").help("The network port to listen to"))
10 .flag(
11 Flag::new()
12 .short("-h")
13 .long("--help")
14 .help("Prints help information."),
15 )
16 .flag(
17 Flag::new()
18 .short("-V")
19 .long("--version")
20 .help("Prints version information."),
21 )
22 .flag(
23 Flag::new()
24 .short("-v")
25 .long("--verbosity")
26 .help("Pass multiple times to print more information."),
27 )
28 .option(
29 Opt::new("port")
30 .short("-p")
31 .long("--port")
32 .help("The network port to listen to."),
33 )
34 .example(
35 Example::new()
36 .text("listen on port 3000")
37 .command("auth-service -p 3000")
38 .output("now listening on port 3000"),
39 )
40 .example(
41 Example::new()
42 .text("auth-service may need to be run by root")
43 .prompt("#")
44 .command("auth-service"),
45 )
46 .custom(
47 Section::new("custom section")
48 .paragraph("text for the custom section")
49 .paragraph("Additional text for the custom section"),
50 )
51 .author(Author::new("Alice Person").email("alice@person.com"))
52 .author(Author::new("Bob Human").email("bob@human.com"))
53 .render();
54 // .option(Some("-o"), Some("--output"), "output", None, "Output file");
55
56 println!("{}", msg);
57}
Sourcepub fn flag(self, flag: Flag) -> Self
pub fn flag(self, flag: Flag) -> Self
Add an flag.
Examples found in repository?
examples/main.rs (lines 10-15)
5fn main() {
6 let msg = Manual::new("auth-service")
7 .about("authorize & authenticate members")
8 .arg(Arg::new("path"))
9 .env(Env::new("PORT").help("The network port to listen to"))
10 .flag(
11 Flag::new()
12 .short("-h")
13 .long("--help")
14 .help("Prints help information."),
15 )
16 .flag(
17 Flag::new()
18 .short("-V")
19 .long("--version")
20 .help("Prints version information."),
21 )
22 .flag(
23 Flag::new()
24 .short("-v")
25 .long("--verbosity")
26 .help("Pass multiple times to print more information."),
27 )
28 .option(
29 Opt::new("port")
30 .short("-p")
31 .long("--port")
32 .help("The network port to listen to."),
33 )
34 .example(
35 Example::new()
36 .text("listen on port 3000")
37 .command("auth-service -p 3000")
38 .output("now listening on port 3000"),
39 )
40 .example(
41 Example::new()
42 .text("auth-service may need to be run by root")
43 .prompt("#")
44 .command("auth-service"),
45 )
46 .custom(
47 Section::new("custom section")
48 .paragraph("text for the custom section")
49 .paragraph("Additional text for the custom section"),
50 )
51 .author(Author::new("Alice Person").email("alice@person.com"))
52 .author(Author::new("Bob Human").email("bob@human.com"))
53 .render();
54 // .option(Some("-o"), Some("--output"), "output", None, "Output file");
55
56 println!("{}", msg);
57}
Sourcepub fn option(self, opt: Opt) -> Self
pub fn option(self, opt: Opt) -> Self
Add an option.
Examples found in repository?
examples/main.rs (lines 28-33)
5fn main() {
6 let msg = Manual::new("auth-service")
7 .about("authorize & authenticate members")
8 .arg(Arg::new("path"))
9 .env(Env::new("PORT").help("The network port to listen to"))
10 .flag(
11 Flag::new()
12 .short("-h")
13 .long("--help")
14 .help("Prints help information."),
15 )
16 .flag(
17 Flag::new()
18 .short("-V")
19 .long("--version")
20 .help("Prints version information."),
21 )
22 .flag(
23 Flag::new()
24 .short("-v")
25 .long("--verbosity")
26 .help("Pass multiple times to print more information."),
27 )
28 .option(
29 Opt::new("port")
30 .short("-p")
31 .long("--port")
32 .help("The network port to listen to."),
33 )
34 .example(
35 Example::new()
36 .text("listen on port 3000")
37 .command("auth-service -p 3000")
38 .output("now listening on port 3000"),
39 )
40 .example(
41 Example::new()
42 .text("auth-service may need to be run by root")
43 .prompt("#")
44 .command("auth-service"),
45 )
46 .custom(
47 Section::new("custom section")
48 .paragraph("text for the custom section")
49 .paragraph("Additional text for the custom section"),
50 )
51 .author(Author::new("Alice Person").email("alice@person.com"))
52 .author(Author::new("Bob Human").email("bob@human.com"))
53 .render();
54 // .option(Some("-o"), Some("--output"), "output", None, "Output file");
55
56 println!("{}", msg);
57}
Sourcepub fn custom(self, custom_section: Section) -> Self
pub fn custom(self, custom_section: Section) -> Self
Add a custom section
Examples found in repository?
examples/main.rs (lines 46-50)
5fn main() {
6 let msg = Manual::new("auth-service")
7 .about("authorize & authenticate members")
8 .arg(Arg::new("path"))
9 .env(Env::new("PORT").help("The network port to listen to"))
10 .flag(
11 Flag::new()
12 .short("-h")
13 .long("--help")
14 .help("Prints help information."),
15 )
16 .flag(
17 Flag::new()
18 .short("-V")
19 .long("--version")
20 .help("Prints version information."),
21 )
22 .flag(
23 Flag::new()
24 .short("-v")
25 .long("--verbosity")
26 .help("Pass multiple times to print more information."),
27 )
28 .option(
29 Opt::new("port")
30 .short("-p")
31 .long("--port")
32 .help("The network port to listen to."),
33 )
34 .example(
35 Example::new()
36 .text("listen on port 3000")
37 .command("auth-service -p 3000")
38 .output("now listening on port 3000"),
39 )
40 .example(
41 Example::new()
42 .text("auth-service may need to be run by root")
43 .prompt("#")
44 .command("auth-service"),
45 )
46 .custom(
47 Section::new("custom section")
48 .paragraph("text for the custom section")
49 .paragraph("Additional text for the custom section"),
50 )
51 .author(Author::new("Alice Person").email("alice@person.com"))
52 .author(Author::new("Bob Human").email("bob@human.com"))
53 .render();
54 // .option(Some("-o"), Some("--output"), "output", None, "Output file");
55
56 println!("{}", msg);
57}
Sourcepub fn example(self, example: Example) -> Self
pub fn example(self, example: Example) -> Self
Add an examples section
Examples found in repository?
examples/main.rs (lines 34-39)
5fn main() {
6 let msg = Manual::new("auth-service")
7 .about("authorize & authenticate members")
8 .arg(Arg::new("path"))
9 .env(Env::new("PORT").help("The network port to listen to"))
10 .flag(
11 Flag::new()
12 .short("-h")
13 .long("--help")
14 .help("Prints help information."),
15 )
16 .flag(
17 Flag::new()
18 .short("-V")
19 .long("--version")
20 .help("Prints version information."),
21 )
22 .flag(
23 Flag::new()
24 .short("-v")
25 .long("--verbosity")
26 .help("Pass multiple times to print more information."),
27 )
28 .option(
29 Opt::new("port")
30 .short("-p")
31 .long("--port")
32 .help("The network port to listen to."),
33 )
34 .example(
35 Example::new()
36 .text("listen on port 3000")
37 .command("auth-service -p 3000")
38 .output("now listening on port 3000"),
39 )
40 .example(
41 Example::new()
42 .text("auth-service may need to be run by root")
43 .prompt("#")
44 .command("auth-service"),
45 )
46 .custom(
47 Section::new("custom section")
48 .paragraph("text for the custom section")
49 .paragraph("Additional text for the custom section"),
50 )
51 .author(Author::new("Alice Person").email("alice@person.com"))
52 .author(Author::new("Bob Human").email("bob@human.com"))
53 .render();
54 // .option(Some("-o"), Some("--output"), "output", None, "Output file");
55
56 println!("{}", msg);
57}
Sourcepub fn arg(self, arg: Arg) -> Self
pub fn arg(self, arg: Arg) -> Self
Add a positional argument. The items are displayed in the order they’re pushed.
Examples found in repository?
examples/main.rs (line 8)
5fn main() {
6 let msg = Manual::new("auth-service")
7 .about("authorize & authenticate members")
8 .arg(Arg::new("path"))
9 .env(Env::new("PORT").help("The network port to listen to"))
10 .flag(
11 Flag::new()
12 .short("-h")
13 .long("--help")
14 .help("Prints help information."),
15 )
16 .flag(
17 Flag::new()
18 .short("-V")
19 .long("--version")
20 .help("Prints version information."),
21 )
22 .flag(
23 Flag::new()
24 .short("-v")
25 .long("--verbosity")
26 .help("Pass multiple times to print more information."),
27 )
28 .option(
29 Opt::new("port")
30 .short("-p")
31 .long("--port")
32 .help("The network port to listen to."),
33 )
34 .example(
35 Example::new()
36 .text("listen on port 3000")
37 .command("auth-service -p 3000")
38 .output("now listening on port 3000"),
39 )
40 .example(
41 Example::new()
42 .text("auth-service may need to be run by root")
43 .prompt("#")
44 .command("auth-service"),
45 )
46 .custom(
47 Section::new("custom section")
48 .paragraph("text for the custom section")
49 .paragraph("Additional text for the custom section"),
50 )
51 .author(Author::new("Alice Person").email("alice@person.com"))
52 .author(Author::new("Bob Human").email("bob@human.com"))
53 .render();
54 // .option(Some("-o"), Some("--output"), "output", None, "Output file");
55
56 println!("{}", msg);
57}
Sourcepub fn render(self) -> String
pub fn render(self) -> String
Render to a string.
Examples found in repository?
examples/main.rs (line 53)
5fn main() {
6 let msg = Manual::new("auth-service")
7 .about("authorize & authenticate members")
8 .arg(Arg::new("path"))
9 .env(Env::new("PORT").help("The network port to listen to"))
10 .flag(
11 Flag::new()
12 .short("-h")
13 .long("--help")
14 .help("Prints help information."),
15 )
16 .flag(
17 Flag::new()
18 .short("-V")
19 .long("--version")
20 .help("Prints version information."),
21 )
22 .flag(
23 Flag::new()
24 .short("-v")
25 .long("--verbosity")
26 .help("Pass multiple times to print more information."),
27 )
28 .option(
29 Opt::new("port")
30 .short("-p")
31 .long("--port")
32 .help("The network port to listen to."),
33 )
34 .example(
35 Example::new()
36 .text("listen on port 3000")
37 .command("auth-service -p 3000")
38 .output("now listening on port 3000"),
39 )
40 .example(
41 Example::new()
42 .text("auth-service may need to be run by root")
43 .prompt("#")
44 .command("auth-service"),
45 )
46 .custom(
47 Section::new("custom section")
48 .paragraph("text for the custom section")
49 .paragraph("Additional text for the custom section"),
50 )
51 .author(Author::new("Alice Person").email("alice@person.com"))
52 .author(Author::new("Bob Human").email("bob@human.com"))
53 .render();
54 // .option(Some("-o"), Some("--output"), "output", None, "Output file");
55
56 println!("{}", msg);
57}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Manual
impl RefUnwindSafe for Manual
impl Send for Manual
impl Sync for Manual
impl Unpin for Manual
impl UnwindSafe for Manual
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more