package buildpacks import ( "strings" "github.com/dokku/dokku/plugins/common" ) // ReportSingleApp is an internal function that displays the buildpacks report for one or more apps 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{ "--buildpacks-list": reportList, } } flagKeys := []string{} for flagKey := range flags { flagKeys = append(flagKeys, flagKey) } infoFlags := common.CollectReport(appName, infoFlag, flags) return common.ReportSingleApp(common.ReportSingleAppInput{ ReportType: "buildpacks", AppName: appName, InfoFlag: infoFlag, InfoFlags: infoFlags, InfoFlagKeys: flagKeys, Format: format, TrimPrefix: true, UppercaseFirstCharacter: true, EmitLegacyPrefix: true, }) } func reportList(appName string) string { buildpacks, err := common.PropertyListGet("buildpacks", appName, "buildpacks") if err != nil { return "" } return strings.Join(buildpacks, ",") }