feat: add created-at time to apps:report output

This commit is contained in:
Jose Diaz-Gonzalez
2021-10-27 21:03:04 -04:00
parent 7a4ead4db4
commit c3871e7da9
2 changed files with 16 additions and 0 deletions

View File

@@ -1,6 +1,9 @@
package apps
import (
"fmt"
"os"
"github.com/dokku/dokku/plugins/common"
)
@@ -11,6 +14,7 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
}
flags := map[string]common.ReportFunc{
"--app-created-at": reportCreatedAt,
"--app-deploy-source": reportDeploySource,
"--app-deploy-source-metadata": reportDeploySourceMetadata,
"--app-dir": reportDir,
@@ -28,6 +32,15 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
return common.ReportSingleApp("app", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
}
func reportCreatedAt(appName string) string {
fi, err := os.Stat(common.AppRoot(appName))
if err != nil {
return ""
}
return fmt.Sprint(fi.ModTime().Unix())
}
func reportDeploySource(appName string) string {
return common.PropertyGet("apps", appName, "deploy-source")
}