mirror of
https://github.com/dokku/dokku.git
synced 2026-09-03 04:32:26 +02:00
Every `:report` subcommand now recognizes `--global` as a scope selector that limits the report to globally-configured properties, including in JSON form via `--global --format json`. Previously this combination was rejected because `--global` was treated as an info flag, conflicting with `--format`. The shared `common.ParseReportArgs` helper now returns a `ReportArgs` struct exposing the parsed scope; each Go and bash report selects a global-only flag map when scope is global, and skips per-app verification.
45 lines
1.2 KiB
Go
45 lines
1.2 KiB
Go
package storage
|
|
|
|
import "github.com/dokku/dokku/plugins/common"
|
|
|
|
func ReportSingleApp(appName string, format string, infoFlag string) error {
|
|
if appName != "--global" {
|
|
if err := common.VerifyAppName(appName); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
var flags map[string]common.ReportFunc
|
|
if appName == "--global" {
|
|
flags = map[string]common.ReportFunc{}
|
|
} else {
|
|
flags = map[string]common.ReportFunc{
|
|
"--storage-build-mounts": reportBuildMounts,
|
|
"--storage-deploy-mounts": reportDeployMounts,
|
|
"--storage-run-mounts": reportRunMounts,
|
|
}
|
|
}
|
|
|
|
flagKeys := []string{}
|
|
for flagKey := range flags {
|
|
flagKeys = append(flagKeys, flagKey)
|
|
}
|
|
|
|
trimPrefix := false
|
|
uppercaseFirstCharacter := true
|
|
infoFlags := common.CollectReport(appName, infoFlag, flags)
|
|
return common.ReportSingleApp("storage", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
|
|
}
|
|
|
|
func reportBuildMounts(appName string) string {
|
|
return GetBindMountsForDisplay(appName, "build")
|
|
}
|
|
|
|
func reportDeployMounts(appName string) string {
|
|
return GetBindMountsForDisplay(appName, "deploy")
|
|
}
|
|
|
|
func reportRunMounts(appName string) string {
|
|
return GetBindMountsForDisplay(appName, "run")
|
|
}
|