Skip to content

Commit 35334b0

Browse files
committed
Reformat usage string
The help/usage string was getting a little unwieldly. Reformat it for better readability.
1 parent c3d80b3 commit 35334b0

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

docker-gen.go

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,21 @@ func (r *RuntimeContainer) PublishedAddresses() []Address {
151151
}
152152

153153
func usage() {
154-
println("Usage: docker-gen [-config file] [-watch=false] [-notify=\"restart xyz\"] [-notify-sighup=\"container-ID\"] [-interval=0] [-endpoint tcp|unix://..] [-tlscert file] [-tlskey file] [-tlscacert file] [-tlsverify] <template> [<dest>]")
154+
println(`Usage: docker-gen [options] template [dest]
155+
156+
Generate files from docker container meta-data
157+
158+
Options:`)
159+
flag.PrintDefaults()
160+
161+
println(`
162+
Arguments:
163+
template - path to a template to generate
164+
dest - path to a write the template. If not specfied, STDOUT is used
165+
166+
Environment Variables:
167+
DOCKER_HOST - default value for -endpoint
168+
`)
155169
}
156170

157171
func NewDockerClient(endpoint string) (*docker.Client, error) {
@@ -349,16 +363,20 @@ func initFlags() {
349363
flag.BoolVar(&version, "version", false, "show version")
350364
flag.BoolVar(&watch, "watch", false, "watch for container changes")
351365
flag.BoolVar(&onlyExposed, "only-exposed", false, "only include containers with exposed ports")
352-
flag.BoolVar(&onlyPublished, "only-published", false, "only include containers with published ports (implies -only-exposed)")
353-
flag.StringVar(&notifyCmd, "notify", "", "run command after template is regenerated")
354-
flag.StringVar(&notifySigHUPContainerID, "notify-sighup", "", "send HUP signal to container. Equivalent to `docker kill -s HUP container-ID`")
366+
367+
flag.BoolVar(&onlyPublished, "only-published", false,
368+
"only include containers with published ports (implies -only-exposed)")
369+
flag.StringVar(&notifyCmd, "notify", "", "run command after template is regenerated (e.g `restart xyz`)")
370+
flag.StringVar(&notifySigHUPContainerID, "notify-sighup", "",
371+
"send HUP signal to container. Equivalent to `docker kill -s HUP container-ID`")
355372
flag.Var(&configFiles, "config", "config files with template directives. Config files will be merged if this option is specified multiple times.")
356-
flag.IntVar(&interval, "interval", 0, "notify command interval (s)")
357-
flag.StringVar(&endpoint, "endpoint", "", "docker api endpoint")
373+
flag.IntVar(&interval, "interval", 0, "notify command interval (secs)")
374+
flag.StringVar(&endpoint, "endpoint", "", "docker api endpoint (tcp|unix://..). Default unix:///var/run/docker.sock")
358375
flag.StringVar(&tlsCert, "tlscert", "", "path to TLS client certificate file")
359376
flag.StringVar(&tlsKey, "tlskey", "", "path to TLS client key file")
360377
flag.StringVar(&tlsCaCert, "tlscacert", "", "path to TLS CA certificate file")
361378
flag.BoolVar(&tlsVerify, "tlsverify", false, "verify docker daemon's TLS certicate")
379+
flag.Usage = usage
362380
flag.Parse()
363381
}
364382

0 commit comments

Comments
 (0)