Skip to content

Commit

Permalink
Replaced --verbosity with --quiet
Browse files Browse the repository at this point in the history
I wasn't using the verosity levels, but just turning logging on and off.

So I renamed the flag.
  • Loading branch information
docwhat committed Jul 15, 2016
1 parent 9d22f30 commit 06670b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Usage
-----

~~~
usage: docker-gc [<flags>]
usage: docker-gc_darwin_amd64 [<flags>]
The missing docker garbage collector.
Expand All @@ -46,8 +46,10 @@ Flags:
DOCKER_GC_MAX_IMAGE_AGE)
-s, --sweeper-time=15m How much time between running checks to delete
images. (Env: DOCKER_GC_SWEEPER_TIME)
-v, --verbosity=1 How much logging to stderr. 0 = none. 9 = maximal
(Env: DOCKER_GC_VERBOSITY)
-d, --dangle-safe-duration=30m
How old should a dangle image be before deletion.
(Env: DOCKER_GC_DANGLE_SAFE_DURATION)
-q, --quiet Don't show any output. (Env: DOCKER_GC_QUIET)
~~~

It uses the normal Docker environment variables, so if `docker info` works,
Expand Down
6 changes: 3 additions & 3 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Config struct {
MaxAgeOfImages time.Duration
SweeperTime time.Duration
DangleSafeDuration time.Duration
Verbosity uint8
Quiet bool
Version string
}

Expand All @@ -30,15 +30,15 @@ func NewConfig() Config {
kingpin.Flag("max-image-age", "How old to allow images to be before deletion. (Env: DOCKER_GC_MAX_IMAGE_AGE)").Short('m').Default("168h").OverrideDefaultFromEnvar("DOCKER_GC_MAX_IMAGE_AGE").DurationVar(&config.MaxAgeOfImages)
kingpin.Flag("sweeper-time", "How much time between running checks to delete images. (Env: DOCKER_GC_SWEEPER_TIME)").Short('s').Default("15m").OverrideDefaultFromEnvar("DOCKER_GC_SWEEPER_TIME").DurationVar(&config.SweeperTime)
kingpin.Flag("dangle-safe-duration", "How old should a dangle image be before deletion. (Env: DOCKER_GC_DANGLE_SAFE_DURATION)").Short('d').Default("30m").OverrideDefaultFromEnvar("DOCKER_GC_DANGLE_SAFE_DURATION").DurationVar(&config.DangleSafeDuration)
kingpin.Flag("verbosity", "How much logging to stderr. 0 = none. 9 = maximal (Env: DOCKER_GC_VERBOSITY)").Short('v').Default("1").OverrideDefaultFromEnvar("DOCKER_GC_VERBOSITY").Uint8Var(&config.Verbosity)
kingpin.Flag("quiet", "Don't show any output. (Env: DOCKER_GC_QUIET)").Short('q').Default("false").OverrideDefaultFromEnvar("DOCKER_GC_QUIET").BoolVar(&config.Quiet)

kingpin.Parse()

if config.SweeperTime < (4 * time.Second) {
kingpin.Fatalf("You must set the sweeper-time to greater or equal than 4s")
}

if config.Verbosity == 0 {
if config.Quiet {
log.SetOutput(ioutil.Discard)
}
return config
Expand Down

0 comments on commit 06670b0

Please sign in to comment.