feat: accept --global on :report subcommands
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.
This commit is contained in:
@@ -9,22 +9,34 @@ import (
|
||||
|
||||
// ReportSingleApp is an internal function that displays the logs report for one or more apps
|
||||
func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
if err := common.VerifyAppName(appName); err != nil {
|
||||
return err
|
||||
if appName != "--global" {
|
||||
if err := common.VerifyAppName(appName); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
os.Setenv("DOKKU_REPORT_FORMAT", format)
|
||||
os.Setenv("DOKKU_REPORT_FLAG", infoFlag)
|
||||
flags := map[string]common.ReportFunc{
|
||||
"--logs-computed-app-label-alias": reportComputedAppLabelAlias,
|
||||
"--logs-computed-max-size": reportComputedMaxSize,
|
||||
"--logs-global-app-label-alias": reportGlobalAppLabelAlias,
|
||||
"--logs-global-max-size": reportGlobalMaxSize,
|
||||
"--logs-global-vector-sink": reportGlobalVectorSink,
|
||||
"--logs-app-label-alias": reportAppLabelAlias,
|
||||
"--logs-max-size": reportMaxSize,
|
||||
"--logs-vector-global-image": reportVectorGlobalImage,
|
||||
"--logs-vector-sink": reportVectorSink,
|
||||
var flags map[string]common.ReportFunc
|
||||
if appName == "--global" {
|
||||
flags = map[string]common.ReportFunc{
|
||||
"--logs-global-app-label-alias": reportGlobalAppLabelAlias,
|
||||
"--logs-global-max-size": reportGlobalMaxSize,
|
||||
"--logs-global-vector-sink": reportGlobalVectorSink,
|
||||
"--logs-vector-global-image": reportVectorGlobalImage,
|
||||
}
|
||||
} else {
|
||||
flags = map[string]common.ReportFunc{
|
||||
"--logs-computed-app-label-alias": reportComputedAppLabelAlias,
|
||||
"--logs-computed-max-size": reportComputedMaxSize,
|
||||
"--logs-global-app-label-alias": reportGlobalAppLabelAlias,
|
||||
"--logs-global-max-size": reportGlobalMaxSize,
|
||||
"--logs-global-vector-sink": reportGlobalVectorSink,
|
||||
"--logs-app-label-alias": reportAppLabelAlias,
|
||||
"--logs-max-size": reportMaxSize,
|
||||
"--logs-vector-global-image": reportVectorGlobalImage,
|
||||
"--logs-vector-sink": reportVectorSink,
|
||||
}
|
||||
}
|
||||
|
||||
flagKeys := []string{}
|
||||
|
||||
Reference in New Issue
Block a user