-
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #531 from DannyBen/fix/examples-on-error
Fix `show_examples_on_error` when no examples
- Loading branch information
Showing
7 changed files
with
63 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
17 changes: 17 additions & 0 deletions
17
spec/approvals/fixtures/examples-on-error-without-examples
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,17 @@ | ||
creating user files in src | ||
created src/download_command.sh | ||
created src/upload_command.sh | ||
created ./cli | ||
run ./cli --help to test your bash script | ||
+ ./cli download | ||
missing required argument: SOURCE | ||
usage: cli download SOURCE | ||
+ ./cli upload | ||
missing required argument: SOURCE | ||
usage: cli upload SOURCE | ||
examples: | ||
Upload a file | ||
$ cli upload profile.png -u admin -p s3cr3t | ||
|
||
Upload a file (you will be prompted to provide a password) | ||
$ cli upload profile.png --user admin |
2 changes: 2 additions & 0 deletions
2
spec/fixtures/workspaces/examples-on-error-without-examples/.gitignore
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,2 @@ | ||
cli | ||
src/*.sh |
4 changes: 4 additions & 0 deletions
4
spec/fixtures/workspaces/examples-on-error-without-examples/README.md
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,4 @@ | ||
This fixture tests that generation does not fail when there are no examples, | ||
and `show_examples_on_error` is set. | ||
|
||
Reference issue: https://github.com/DannyBen/bashly/pull/530#issuecomment-2210714825 |
1 change: 1 addition & 0 deletions
1
spec/fixtures/workspaces/examples-on-error-without-examples/settings.yml
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 @@ | ||
show_examples_on_error: true |
27 changes: 27 additions & 0 deletions
27
spec/fixtures/workspaces/examples-on-error-without-examples/src/bashly.yml
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,27 @@ | ||
name: cli | ||
version: 0.1.0 | ||
|
||
commands: | ||
- name: download | ||
help: Download a file | ||
|
||
args: | ||
- name: source | ||
required: true | ||
help: URL to download from | ||
|
||
- name: upload | ||
help: Upload a file | ||
args: | ||
- name: source | ||
required: true | ||
help: File to upload | ||
|
||
examples: |- | ||
Upload a file | ||
$ cli upload profile.png -u admin -p s3cr3t | ||
Upload a file (you will be prompted to provide a password) | ||
$ cli upload profile.png --user admin | ||
11 changes: 11 additions & 0 deletions
11
spec/fixtures/workspaces/examples-on-error-without-examples/test.sh
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,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
rm -f ./src/*.sh | ||
rm -f ./cli | ||
|
||
bundle exec bashly generate | ||
|
||
set -x | ||
|
||
./cli download | ||
./cli upload |