2019-11-27 01:24:29 -07:00
|
|
|
# -*- sh -*-
|
|
|
|
|
2015-05-17 00:46:56 -07:00
|
|
|
list_all_command() {
|
2015-05-26 23:46:17 -07:00
|
|
|
local plugin_name=$1
|
2019-11-22 11:37:46 -07:00
|
|
|
local query=$2
|
2017-09-04 10:04:56 -07:00
|
|
|
local plugin_path
|
|
|
|
plugin_path=$(get_plugin_path "$plugin_name")
|
|
|
|
check_if_plugin_exists "$plugin_name"
|
2015-05-21 22:17:44 -07:00
|
|
|
|
2017-09-04 10:04:56 -07:00
|
|
|
local versions
|
|
|
|
versions=$(bash "${plugin_path}/bin/list-all")
|
2015-05-07 22:58:07 -07:00
|
|
|
|
2019-11-22 11:37:46 -07:00
|
|
|
if [[ $query ]]; then
|
2019-11-29 09:15:38 -07:00
|
|
|
versions=$(echo "$versions" |
|
|
|
|
tr ' ' '\n' |
|
2020-01-29 06:04:39 -07:00
|
|
|
grep -E "^\\s*$query" |
|
2019-11-29 09:15:38 -07:00
|
|
|
tr '\n' ' ')
|
2019-11-22 11:37:46 -07:00
|
|
|
fi
|
|
|
|
|
2019-11-29 09:15:38 -07:00
|
|
|
IFS=' ' read -r -a versions_list <<<"$versions"
|
2015-05-07 22:58:07 -07:00
|
|
|
|
2019-11-29 09:15:38 -07:00
|
|
|
for version in "${versions_list[@]}"; do
|
2015-05-17 00:46:56 -07:00
|
|
|
echo "${version}"
|
|
|
|
done
|
|
|
|
}
|
2019-11-27 01:24:29 -07:00
|
|
|
|
|
|
|
list_all_command "$@"
|