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:
Jose Diaz-Gonzalez
2026-04-29 04:47:15 -04:00
parent ec70e10c5d
commit 8282981361
61 changed files with 1379 additions and 518 deletions

View File

@@ -12,14 +12,21 @@ import (
// Process-scoped options surface as dynamic per-process keys, one per
// configured process+phase combination.
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
}
}
flags := map[string]common.ReportFunc{
"--docker-options-build": reportBuildOptions,
"--docker-options-deploy": reportDeployOptions,
"--docker-options-run": reportRunOptions,
var flags map[string]common.ReportFunc
if appName == "--global" {
flags = map[string]common.ReportFunc{}
} else {
flags = map[string]common.ReportFunc{
"--docker-options-build": reportBuildOptions,
"--docker-options-deploy": reportDeployOptions,
"--docker-options-run": reportRunOptions,
}
}
processTypes, err := ListProcessTypesWithOptions(appName)

View File

@@ -84,11 +84,14 @@ func main() {
case "report":
args := flag.NewFlagSet("docker-options:report", flag.ExitOnError)
format := args.String("format", "stdout", "format: [ stdout | json ]")
osArgs, infoFlag, flagErr := common.ParseReportArgs("docker-options", os.Args[2:])
reportArgs, flagErr := common.ParseReportArgs("docker-options", os.Args[2:])
if flagErr == nil {
args.Parse(osArgs)
args.Parse(reportArgs.OSArgs)
appName := args.Arg(0)
err = dockeroptions.CommandReport(appName, *format, infoFlag)
if reportArgs.IsGlobal {
appName = "--global"
}
err = dockeroptions.CommandReport(appName, *format, reportArgs.InfoFlag)
} else {
err = flagErr
}