Skip to content

Commit

Permalink
Update help code to handle optional help callback scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Stratus3D committed Jul 28, 2020
1 parent 26e1949 commit 612acc4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions lib/commands/command-help.bash
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ help_command() {
plugin_path=$(get_plugin_path "$plugin_name")

if [ -d "$plugin_path" ]; then
if [ -f "${plugin_path}/bin/download" ]; then
if [ -f "${plugin_path}/bin/help.overview" ]; then
if [ -n "$tool_version" ]; then

# TODO: Refactor this code out into helper functions in utils.bash
Expand Down Expand Up @@ -69,10 +69,11 @@ help_command() {
export ASDF_INSTALL_VERSION=$version
# shellcheck disable=SC2031
export ASDF_INSTALL_PATH=$install_path
bash "${plugin_path}"/bin/documentation

print_plugin_help $plugin_path
)
else
(bash "${plugin_path}"/bin/documentation)
(print_plugin_help $plugin_path)
fi
else
echo "No documentation for plugin $plugin_name" >&2
Expand All @@ -90,4 +91,24 @@ help_command() {
fi
}

print_plugin_help() {
local plugin_path=$1

# Eventually @jthegedus or someone else will format the output from these
# scripts in a certain way.
bash "${plugin_path}"/bin/help.overview

if [ -f "${plugin_path}"/bin/help.deps ]; then
bash "${plugin_path}"/bin/help.deps
fi

if [ -f "${plugin_path}"/bin/help.config ]; then
bash "${plugin_path}"/bin/help.config
fi

if [ -f "${plugin_path}"/bin/help.links ]; then
bash "${plugin_path}"/bin/help.links
fi
}

help_command "$@"

0 comments on commit 612acc4

Please sign in to comment.