refactor: parallelize report commands
This will make reports a bit faster to run, and is safe to do as reports should not change app state.
This commit is contained in:
@@ -12,23 +12,36 @@ func ReportSingleApp(appName, infoFlag string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
flags := map[string]common.ReportFunc{
|
||||
"--app-dir": reportDir,
|
||||
"--app-deploy-source": reportDeploySource,
|
||||
"--app-locked": reportLocked,
|
||||
}
|
||||
|
||||
trimPrefix := false
|
||||
uppercaseFirstCharacter := true
|
||||
infoFlags := common.CollectReport(appName, flags)
|
||||
return common.ReportSingleApp("app", appName, infoFlag, infoFlags, trimPrefix, uppercaseFirstCharacter)
|
||||
}
|
||||
|
||||
func reportDir(appName string) string {
|
||||
return common.AppRoot(appName)
|
||||
}
|
||||
|
||||
func reportDeploySource(appName string) string {
|
||||
deploySource := ""
|
||||
if b, err := common.PlugnTriggerSetup("deploy-source", []string{appName}...).SetInput("").Output(); err != nil {
|
||||
deploySource = strings.TrimSpace(string(b[:]))
|
||||
}
|
||||
|
||||
return deploySource
|
||||
}
|
||||
|
||||
func reportLocked(appName string) string {
|
||||
locked := "false"
|
||||
if appIsLocked(appName) {
|
||||
locked = "true"
|
||||
}
|
||||
|
||||
infoFlags := map[string]string{
|
||||
"--app-dir": common.AppRoot(appName),
|
||||
"--app-deploy-source": deploySource,
|
||||
"--app-locked": locked,
|
||||
}
|
||||
|
||||
trimPrefix := false
|
||||
uppercaseFirstCharacter := true
|
||||
return common.ReportSingleApp("app", appName, infoFlag, infoFlags, trimPrefix, uppercaseFirstCharacter)
|
||||
return locked
|
||||
}
|
||||
Reference in New Issue
Block a user