feat: add --format json support to plugin:list
Adds a `--format json` flag to `plugin:list` whose output includes each plugin's install source - for git-based third-party plugins, the git remote URL, the checked-out commit, and the followed branch - so the set of installed plugins can be reconstructed elsewhere. Closes #8798.
This commit is contained in:
@@ -8,6 +8,35 @@ cmd-plugin-list() {
|
||||
declare cmd="plugin"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
|
||||
local FORMAT="stdout"
|
||||
local arg
|
||||
while [[ "$#" -gt 0 ]]; do
|
||||
arg="$1"
|
||||
shift
|
||||
case "$arg" in
|
||||
--format)
|
||||
if [[ "$#" -gt 0 ]]; then
|
||||
FORMAT="$1"
|
||||
shift
|
||||
else
|
||||
FORMAT=""
|
||||
fi
|
||||
;;
|
||||
--format=*)
|
||||
FORMAT="${arg#--format=}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ "$FORMAT" != "stdout" ]] && [[ "$FORMAT" != "json" ]]; then
|
||||
dokku_log_fail "Invalid output format specified, supported formats: json, stdout"
|
||||
fi
|
||||
|
||||
if [[ "$FORMAT" == "json" ]]; then
|
||||
"$PLUGIN_AVAILABLE_PATH/plugin/plugin-list" --format json
|
||||
return "$?"
|
||||
fi
|
||||
|
||||
plugn list
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user