dockviz/cli.go

33 lines
1 KiB
Go
Raw Normal View History

package main // import "github.com/justone/dockviz"
2014-04-21 18:30:55 +02:00
import (
2015-05-22 07:33:11 +02:00
"fmt"
2014-04-21 18:30:55 +02:00
"os"
"github.com/jessevdk/go-flags"
)
type GlobalOptions struct {
TLSCaCert string `long:"tlscacert" value-name:"~/.docker/ca.pem" description:"Trust certs signed only by this CA"`
TLSCert string `long:"tlscert" value-name:"~/.docker/cert.pem" description:"Path to TLS certificate file"`
TLSKey string `long:"tlskey" value-name:"~/.docker/key.pem" description:"Path to TLS key file"`
TLSVerify bool `long:"tlsverify" description:"Use TLS and verify the remote"`
Host string `long:"host" short:"H" value-name:"unix:///var/run/docker.sock" description:"Docker host to connect to"`
2015-05-22 07:33:11 +02:00
Version func() `long:"version" short:"v" description:"Display version information."`
2014-04-21 18:30:55 +02:00
}
var globalOptions GlobalOptions
var parser = flags.NewParser(&globalOptions, flags.Default)
2016-06-11 06:16:40 +02:00
var version = "v0.4.1"
2015-05-22 07:33:11 +02:00
2014-04-21 18:30:55 +02:00
func main() {
2015-05-22 07:33:11 +02:00
globalOptions.Version = func() {
fmt.Println("dockviz", version)
os.Exit(0)
}
2014-04-21 18:30:55 +02:00
if _, err := parser.Parse(); err != nil {
os.Exit(1)
}
}