-
Notifications
You must be signed in to change notification settings - Fork 832
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
feat: plugin documentation callback support 🎉 #757
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
22c626c
Add specification for bin/documentation plugin callback script
Stratus3D c6d0b3f
Add support for the plugin documentation callback
Stratus3D 3c48d6d
Add note to plugins guide about variables for documentation callback
Stratus3D a774850
Correct indentation in command-help.bash
Stratus3D 26e1949
Update documentation for help callback scripts
Stratus3D 72b0536
Update help code to handle optional help callback scripts
Stratus3D 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 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,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo "Dummy plugin documentation" | ||
echo | ||
echo "Dummy plugin is a plugin only used for unit tests" | ||
|
||
if [ -n "$ASDF_INSTALL_VERSION" ]; then | ||
echo | ||
echo "Details specific for version $ASDF_INSTALL_VERSION" | ||
fi |
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,76 @@ | ||
#!/usr/bin/env bats | ||
|
||
load test_helpers | ||
|
||
setup() { | ||
setup_asdf_dir | ||
install_dummy_plugin | ||
install_dummy_legacy_plugin | ||
run asdf install dummy 1.0 | ||
run asdf install dummy 1.1 | ||
|
||
PROJECT_DIR=$HOME/project | ||
mkdir $PROJECT_DIR | ||
} | ||
|
||
teardown() { | ||
clean_asdf_dir | ||
} | ||
|
||
@test "help should show dummy plugin help" { | ||
cd $PROJECT_DIR | ||
|
||
run asdf help "dummy" | ||
|
||
expected_output="$(cat <<EOF | ||
Dummy plugin documentation | ||
|
||
Dummy plugin is a plugin only used for unit tests | ||
EOF | ||
)" | ||
[ "$status" -eq 0 ] | ||
[ "$output" = "$expected_output" ] | ||
} | ||
|
||
@test "help should show dummy plugin help specific to version when version is present" { | ||
cd $PROJECT_DIR | ||
|
||
run asdf help "dummy" "1.2.3" | ||
|
||
expected_output="$(cat <<EOF | ||
Dummy plugin documentation | ||
|
||
Dummy plugin is a plugin only used for unit tests | ||
|
||
Details specific for version 1.2.3 | ||
EOF | ||
)" | ||
[ "$status" -eq 0 ] | ||
echo $output | ||
[ "$output" = "$expected_output" ] | ||
} | ||
|
||
@test "help should fail for unknown plugins" { | ||
cd $PROJECT_DIR | ||
|
||
run asdf help "sunny" | ||
[ "$status" -eq 1 ] | ||
[ "$output" == "No plugin named sunny" ] | ||
} | ||
|
||
@test "help should fail when plugin doesn't have documentation callback" { | ||
cd $PROJECT_DIR | ||
|
||
run asdf help "legacy-dummy" | ||
[ "$status" -eq 1 ] | ||
[ "$output" == "No documentation for plugin legacy-dummy" ] | ||
} | ||
|
||
@test "help should show asdf help when no plugin name is provided" { | ||
cd $PROJECT_DIR | ||
|
||
run asdf help | ||
|
||
[ "$status" -eq 0 ] | ||
# TODO: Assert asdf help output is printed | ||
} |
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.
Yes!