Re-apply based on new go flags package (#336)

This commit is contained in:
Zois Pagoulatos 2019-07-21 18:00:56 +02:00 committed by Simon Aronsson
parent 9eca883f17
commit baf5e50051
7 changed files with 58 additions and 34 deletions

View file

@ -1,11 +1,12 @@
package flags
import (
"os"
"time"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"os"
"time"
)
// RegisterDockerFlags that are used directly by the docker api client
@ -52,6 +53,12 @@ func RegisterSystemFlags(rootCmd *cobra.Command) {
viper.GetBool("WATCHTOWER_CLEANUP"),
"remove previously used images after updating")
flags.BoolP(
"remove-volumes",
"",
viper.GetBool("WATCHTOWER_REMOVE_VOLUMES"),
"remove attached volumes before updating")
flags.BoolP(
"label-enable",
"e",
@ -64,7 +71,6 @@ func RegisterSystemFlags(rootCmd *cobra.Command) {
viper.GetBool("WATCHTOWER_DEBUG"),
"enable debug mode with verbose logging")
flags.BoolP(
"monitor-only",
"m",
@ -253,7 +259,6 @@ func ReadFlags(cmd *cobra.Command) (bool, bool, bool, time.Duration) {
return cleanup, noRestart, monitorOnly, timeout
}
func setEnvOptStr(env string, opt string) error {
if opt == "" || opt == os.Getenv(env) {
return nil
@ -271,4 +276,3 @@ func setEnvOptBool(env string, opt bool) error {
}
return nil
}