2015-06-14 05:27:32 -07:00
|
|
|
plugin_list_command() {
|
2018-01-14 01:38:00 -07:00
|
|
|
local flag=$1
|
|
|
|
|
|
|
|
# 0 || 1 with flag
|
2018-06-16 12:04:38 -07:00
|
|
|
if [ $# -eq 0 ] || { [ $# -eq 1 ] && [ "$flag" = "--urls" ]; }; then
|
2018-01-14 01:38:00 -07:00
|
|
|
# valid command
|
|
|
|
|
|
|
|
local plugins_path
|
|
|
|
plugins_path=$(get_plugin_path)
|
|
|
|
|
|
|
|
if ls "$plugins_path" &> /dev/null; then
|
2018-06-16 12:04:38 -07:00
|
|
|
for plugin_path in "$plugins_path"/* ; do
|
2018-01-14 01:38:00 -07:00
|
|
|
plugin_name=$(basename "$plugin_path")
|
|
|
|
|
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
printf "%s\\n" "$plugin_name"
|
|
|
|
else
|
|
|
|
source_url=$(get_plugin_source_url "$plugin_name")
|
|
|
|
printf "%-15s %s\\n" "$plugin_name" "$source_url"
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
else
|
2018-10-04 12:00:25 -07:00
|
|
|
display_error 'Oohes nooes ~! No plugins installed'
|
|
|
|
exit 1
|
2018-01-14 01:38:00 -07:00
|
|
|
fi
|
2018-10-04 12:00:25 -07:00
|
|
|
|
2015-06-14 05:27:32 -07:00
|
|
|
else
|
2018-01-14 01:38:00 -07:00
|
|
|
display_error "usage: asdf plugin-list [--urls]"
|
|
|
|
exit 1
|
2015-06-14 05:27:32 -07:00
|
|
|
fi
|
2018-01-14 01:38:00 -07:00
|
|
|
|
2015-06-14 05:27:32 -07:00
|
|
|
}
|