-
Notifications
You must be signed in to change notification settings - Fork 11
Fixed indentation issues for long commands. #286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,70 @@ | ||
| load test_helpers | ||
|
|
||
| setup() { | ||
| load "${BATS_UTILS_PATH}/bats-support/load.bash" | ||
| load "${BATS_UTILS_PATH}/bats-assert/load.bash" | ||
| cd ./tests/command_group_long | ||
| } | ||
|
|
||
| HELP_MESSAGE=$(cat <<EOF | ||
| A CLI task runner | ||
|
|
||
| Usage: | ||
| lets [flags] | ||
| lets [command] | ||
|
|
||
| Commands: | ||
|
|
||
| A group | ||
| c c command | ||
|
|
||
| B group | ||
| a a command | ||
| b b command | ||
|
|
||
| Common | ||
| d d command | ||
| super_long_command_longer_than_usual Super long command | ||
|
|
||
| Internal commands: | ||
| help Help about any command | ||
| self Manage lets CLI itself | ||
|
|
||
| Flags: | ||
| --all show all commands (including the ones with _) | ||
| -c, --config string config file (default is lets.yaml) | ||
| -d, --debug count show debug logs (or use LETS_DEBUG=1). If used multiple times, shows more verbose logs | ||
| -E, --env stringToString set env variable for running command KEY=VALUE (default []) | ||
| --exclude stringArray run all but excluded command(s) described in cmd as map | ||
| -h, --help help for lets | ||
| --init create a new lets.yaml in the current folder | ||
| --no-depends skip 'depends' for running command | ||
| --only stringArray run only specified command(s) described in cmd as map | ||
| --upgrade upgrade lets to latest version | ||
| -v, --version version for lets | ||
|
|
||
| Use "lets help [command]" for more information about a command. | ||
| EOF | ||
| ) | ||
|
|
||
|
|
||
| @test "help: running 'lets help' should group commands by their group names" { | ||
| run lets help | ||
| assert_success | ||
|
|
||
| assert_output "$HELP_MESSAGE" | ||
| } | ||
|
|
||
| @test "help: running 'lets --help' should group commands by their group names" { | ||
| run lets --help | ||
| assert_success | ||
|
|
||
| assert_output "$HELP_MESSAGE" | ||
| } | ||
|
|
||
| @test "help: running 'lets' should group commands by their group names" { | ||
| run lets | ||
| assert_success | ||
|
|
||
| assert_output "$HELP_MESSAGE" | ||
| } |
This file contains hidden or 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,25 @@ | ||
| shell: bash | ||
|
|
||
| commands: | ||
| b: | ||
| group: B group | ||
| description: b command | ||
| cmd: echo | ||
|
|
||
| a: | ||
| group: B group | ||
| description: a command | ||
| cmd: echo | ||
|
|
||
| c: | ||
| group: A group | ||
| description: c command | ||
| cmd: echo | ||
|
|
||
| d: | ||
| description: d command | ||
| cmd: echo | ||
|
|
||
| super_long_command_longer_than_usual: | ||
| description: Super long command | ||
| cmd: echo "long command" |
This file contains hidden or 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,48 @@ | ||
| load test_helpers | ||
|
|
||
| setup() { | ||
| load "${BATS_UTILS_PATH}/bats-support/load.bash" | ||
| load "${BATS_UTILS_PATH}/bats-assert/load.bash" | ||
| cd ./tests/help_long | ||
| } | ||
|
|
||
| HELP_MESSAGE=$(cat <<EOF | ||
| A CLI task runner | ||
|
|
||
| Usage: | ||
| lets [flags] | ||
| lets [command] | ||
|
|
||
| Commands: | ||
| bar Print bar | ||
| foo Print foo | ||
| super_long_command_longer_than_usual Super long command | ||
|
|
||
| Internal commands: | ||
| help Help about any command | ||
| self Manage lets CLI itself | ||
|
|
||
| Flags: | ||
| --all show all commands (including the ones with _) | ||
| -c, --config string config file (default is lets.yaml) | ||
| -d, --debug count show debug logs (or use LETS_DEBUG=1). If used multiple times, shows more verbose logs | ||
| -E, --env stringToString set env variable for running command KEY=VALUE (default []) | ||
| --exclude stringArray run all but excluded command(s) described in cmd as map | ||
| -h, --help help for lets | ||
| --init create a new lets.yaml in the current folder | ||
| --no-depends skip 'depends' for running command | ||
| --only stringArray run only specified command(s) described in cmd as map | ||
| --upgrade upgrade lets to latest version | ||
| -v, --version version for lets | ||
|
|
||
| Use "lets help [command]" for more information about a command. | ||
| EOF | ||
| ) | ||
|
|
||
|
|
||
| @test "help: run 'lets' as is" { | ||
| run lets | ||
| assert_success | ||
|
|
||
| assert_output "$HELP_MESSAGE" | ||
| } |
This file contains hidden or 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,18 @@ | ||
| shell: bash | ||
|
|
||
| commands: | ||
| _x: | ||
| description: Hidden x | ||
| cmd: echo "x" | ||
|
|
||
| foo: | ||
| description: Print foo | ||
| cmd: echo "Foo" | ||
|
|
||
| bar: | ||
| description: Print bar | ||
| cmd: echo "Bar" | ||
|
|
||
| super_long_command_longer_than_usual: | ||
| description: Super long command | ||
| cmd: echo "long command" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call it for each group. I didn’t want to call it before buildGroupCommandHelp and pass it as a parameter. Since we only have two groups, this is probably fine.