-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow custom help subcommand (#19)
disable help subcommand with `# @help false` custom help subcommand message with `# @help Print help information`
- Loading branch information
Showing
5 changed files
with
98 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
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,60 @@ | ||
#[test] | ||
fn test_no_help_tag() { | ||
let script = r###" | ||
# @cmd | ||
cmd() { :; } | ||
"###; | ||
plain!(script, &["prog"], stderr: r#"prog | ||
USAGE: | ||
prog <SUBCOMMAND> | ||
OPTIONS: | ||
-h, --help Print help information | ||
SUBCOMMANDS: | ||
cmd | ||
help Print this message or the help of the given subcommand(s) | ||
"#,); | ||
} | ||
|
||
#[test] | ||
fn test_no_help_subcommand() { | ||
let script = r###" | ||
# @help false | ||
# @cmd | ||
cmd() { :; } | ||
"###; | ||
plain!(script, &["prog"], stderr: r#"prog | ||
USAGE: | ||
prog <SUBCOMMAND> | ||
OPTIONS: | ||
-h, --help Print help information | ||
SUBCOMMANDS: | ||
cmd | ||
"#,); | ||
} | ||
|
||
#[test] | ||
fn test_custom_help_subcommand_about() { | ||
let script = r###" | ||
# @help Print help information | ||
# @cmd | ||
cmd() { :; } | ||
"###; | ||
plain!(script, &["prog"], stderr: r#"prog | ||
USAGE: | ||
prog <SUBCOMMAND> | ||
OPTIONS: | ||
-h, --help Print help information | ||
SUBCOMMANDS: | ||
cmd | ||
help Print help information | ||
"#,); | ||
} |
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 |
---|---|---|
|
@@ -2,5 +2,6 @@ | |
mod macros; | ||
mod escape_test; | ||
mod fail_test; | ||
mod help_tag_test; | ||
mod main_fn_test; | ||
mod spec_test; |