From 5d07484cc2a0745ba4636d3ef00a71d0766acb6e Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 7 Jul 2026 07:15:19 -0400 Subject: [PATCH] refactor: remove unused bash report helper functions With every bash :report subcommand now ported to golang, the shared fn-report-parse-args, fn-report-emit-json, fn-report-filter-global and fn-report-validate-format helpers are no longer referenced and are removed. --- plugins/common/functions | 59 ---------------------------------------- 1 file changed, 59 deletions(-) diff --git a/plugins/common/functions b/plugins/common/functions index 55c6a2ef2..90bac37e8 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -1028,62 +1028,3 @@ fn-registry-docker-config-dir() { echo "$config_dir" fi } - -fn-report-parse-args() { - declare desc="strips --format and --global flags from a report invocation, populating REPORT_FORMAT, REPORT_IS_GLOBAL, REPORT_ARGS" - REPORT_FORMAT="stdout" - REPORT_IS_GLOBAL="false" - REPORT_ARGS=() - while [[ $# -gt 0 ]]; do - case "$1" in - --format) - REPORT_FORMAT="$2" - shift 2 - ;; - --global) - REPORT_IS_GLOBAL="true" - shift - ;; - *) - REPORT_ARGS+=("$1") - shift - ;; - esac - done -} - -fn-report-emit-json() { - declare desc="serializes a flag_map array (passed by name) as a JSON object, stripping the --- prefix from each key" - declare flag_map_name="$1" prefix="$2" - local -n flag_map_ref="$flag_map_name" - local json_output="{}" - for flag in "${flag_map_ref[@]}"; do - local key value - key="$(echo "$flag" | cut -d':' -f1 | sed "s/^--${prefix}-//")" - value="$(echo "$flag" | cut -d':' -f2- | sed 's/^ //')" - json_output="$(echo "$json_output" | jq -c --arg key "$key" --arg value "$value" '. + {($key): $value}')" - done - echo "$json_output" -} - -fn-report-filter-global() { - declare desc="filters a flag_map array (passed by name) in place, keeping only entries with -global- in their flag name" - declare flag_map_name="$1" - local -n flag_map_ref="$flag_map_name" - local filtered=() - for flag in "${flag_map_ref[@]}"; do - local key="$(echo "$flag" | cut -d':' -f1)" - if [[ "$key" == *"-global-"* ]]; then - filtered+=("$flag") - fi - done - flag_map_ref=("${filtered[@]}") -} - -fn-report-validate-format() { - declare desc="rejects --format json when an info flag is also specified" - declare FORMAT="$1" INFO_FLAG="$2" - if [[ "$FORMAT" != "stdout" ]] && [[ -n "$INFO_FLAG" ]]; then - dokku_log_fail "--format flag cannot be specified when specifying an info flag" - fi -}