From c2fc8dd34e2c8de3a28b4c5c8440d3254a1b33ef Mon Sep 17 00:00:00 2001 From: Kevin Disneur Date: Sun, 14 Jun 2015 13:27:32 +0100 Subject: [PATCH] Add a command to list the plugins already installed --- README.md | 7 +++++++ bin/asdf | 4 ++++ help.txt | 1 + lib/commands/plugin-list.sh | 11 +++++++++++ 4 files changed, 23 insertions(+) create mode 100644 lib/commands/plugin-list.sh diff --git a/README.md b/README.md index 2ba3f05d..d888faf5 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,13 @@ asdf plugin-add # asdf plugin-add erlang https://github.com/HashNuke/asdf-erlang.git ``` +##### List installed plugins + +```bash +asdf plugin-list +# asdf plugin-list +``` + ##### Remove a plugin ```bash diff --git a/bin/asdf b/bin/asdf index ce790204..9cfedf8e 100755 --- a/bin/asdf +++ b/bin/asdf @@ -11,6 +11,7 @@ source $(dirname $(dirname $0))/lib/commands/list.sh source $(dirname $(dirname $0))/lib/commands/list-all.sh source $(dirname $(dirname $0))/lib/commands/reshim.sh source $(dirname $(dirname $0))/lib/commands/plugin-add.sh +source $(dirname $(dirname $0))/lib/commands/plugin-list.sh source $(dirname $(dirname $0))/lib/commands/plugin-update.sh source $(dirname $(dirname $0))/lib/commands/plugin-remove.sh @@ -54,6 +55,9 @@ case $1 in "plugin-add") plugin_add_command $callback_args;; +"plugin-list") + plugin_list_command $callback_args;; + "plugin-update") plugin_update_command $callback_args;; diff --git a/help.txt b/help.txt index 3240e78b..9d8c146b 100644 --- a/help.txt +++ b/help.txt @@ -1,5 +1,6 @@ MANAGE PLUGINS asdf plugin-add Add git repo as plugin + asdf plugin-list List installed plugin asdf plugin-remove Remove plugin and package versions asdf plugin-update Update plugin asdf plugin-update --all Update all plugins diff --git a/lib/commands/plugin-list.sh b/lib/commands/plugin-list.sh new file mode 100644 index 00000000..1105e15a --- /dev/null +++ b/lib/commands/plugin-list.sh @@ -0,0 +1,11 @@ +plugin_list_command() { + local plugins_path=$(get_plugin_path) + + if ls $plugins_path &> /dev/null; then + for plugin_path in $plugins_path/* ; do + echo "* $(basename $plugin_path)" + done + else + echo 'Oohes nooes ~! No versions installed' + fi +}