mirror of
https://github.com/containrrr/watchtower.git
synced 2025-09-22 05:40:50 +02:00
feat: add porcelain output (#1337)
* feat: add porcaline output * feat(du-cli): add create-stale action add create-stale action Signed-off-by: nils måsén * test(flags): add alias tests * fix stray format string ref * fix shell liniting problems * feat(du-cli): remove created images * add test for common template * fix interval/schedule logic * use porcelain arg as template version * fix editor save artifacts * use simpler v1 template Signed-off-by: nils måsén
This commit is contained in:
parent
a429c373ff
commit
7900471f88
13 changed files with 344 additions and 63 deletions
19
cmd/root.go
19
cmd/root.go
|
@ -39,7 +39,6 @@ var (
|
|||
lifecycleHooks bool
|
||||
rollingRestart bool
|
||||
scope string
|
||||
// Set on build using ldflags
|
||||
)
|
||||
|
||||
var rootCmd = NewRootCommand()
|
||||
|
@ -75,6 +74,7 @@ func Execute() {
|
|||
// PreRun is a lifecycle hook that runs before the command is executed.
|
||||
func PreRun(cmd *cobra.Command, _ []string) {
|
||||
f := cmd.PersistentFlags()
|
||||
flags.ProcessFlagAliases(f)
|
||||
|
||||
if enabled, _ := f.GetBool("no-color"); enabled {
|
||||
log.SetFormatter(&log.TextFormatter{
|
||||
|
@ -94,18 +94,7 @@ func PreRun(cmd *cobra.Command, _ []string) {
|
|||
log.SetLevel(log.TraceLevel)
|
||||
}
|
||||
|
||||
pollingSet := f.Changed("interval")
|
||||
schedule, _ := f.GetString("schedule")
|
||||
cronLen := len(schedule)
|
||||
|
||||
if pollingSet && cronLen > 0 {
|
||||
log.Fatal("Only schedule or interval can be defined, not both.")
|
||||
} else if cronLen > 0 {
|
||||
scheduleSpec, _ = f.GetString("schedule")
|
||||
} else {
|
||||
interval, _ := f.GetInt("interval")
|
||||
scheduleSpec = "@every " + strconv.Itoa(interval) + "s"
|
||||
}
|
||||
scheduleSpec, _ = f.GetString("schedule")
|
||||
|
||||
flags.GetSecretsFromFiles(cmd)
|
||||
cleanup, noRestart, monitorOnly, timeout = flags.ReadFlags(cmd)
|
||||
|
@ -119,7 +108,9 @@ func PreRun(cmd *cobra.Command, _ []string) {
|
|||
rollingRestart, _ = f.GetBool("rolling-restart")
|
||||
scope, _ = f.GetString("scope")
|
||||
|
||||
log.Debug(scope)
|
||||
if scope != "" {
|
||||
log.Debugf(`Using scope %q`, scope)
|
||||
}
|
||||
|
||||
// configure environment vars for client
|
||||
err := flags.EnvConfig(cmd)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue