-
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.
Merge branch 'master' into exit-status
- Loading branch information
Showing
7 changed files
with
489 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,12 @@ fn main() { | |
.long("--output") | ||
.help("The file path to write output to"), | ||
) | ||
.example( | ||
Example::new() | ||
.text("run basic in debug mode") | ||
.command("basic -d") | ||
.output("Debug Mode: basic will print errors to the console") | ||
) | ||
.custom( | ||
Section::new("usage note") | ||
.paragraph("This program will overwrite any file currently stored at the output path") | ||
|
@@ -72,13 +78,19 @@ OPTIONS | |
USAGE NOTE | ||
This file will overwrite any file currently stored at the output path. | ||
EXIT STATUS | ||
0 Successful program execution. | ||
1 Unsuccessful program execution. | ||
101 The program panicked. | ||
EXAMPLES | ||
run basic in debug mode | ||
$ basic -d | ||
Debug Mode: basic will print errors to the console | ||
AUTHORS | ||
Alice Person <[email protected]> | ||
Bob Human <[email protected]> | ||
|
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,39 @@ | ||
/// Add a examples section | ||
#[derive(Debug, Clone, Default)] | ||
pub struct Example { | ||
pub(crate) prompt: &'static str, | ||
pub(crate) text: Option<&'static str>, | ||
pub(crate) command: Option<&'static str>, | ||
pub(crate) output: Option<&'static str>, | ||
} | ||
|
||
impl Example { | ||
pub fn new() -> Self { | ||
Self { | ||
prompt: "$", | ||
text: None, | ||
command: None, | ||
output: None, | ||
} | ||
} | ||
|
||
pub fn prompt(mut self, prompt: &'static str) -> Self { | ||
self.prompt = prompt; | ||
self | ||
} | ||
|
||
pub fn text(mut self, text: &'static str) -> Self { | ||
self.text = Some(text); | ||
self | ||
} | ||
|
||
pub fn command(mut self, command: &'static str) -> Self { | ||
self.command = Some(command); | ||
self | ||
} | ||
|
||
pub fn output(mut self, output: &'static str) -> Self { | ||
self.output = Some(output); | ||
self | ||
} | ||
} |
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
Oops, something went wrong.