Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
fix(fleetctl): manually handle version flag
Browse files Browse the repository at this point in the history
  • Loading branch information
bcwaldon committed Feb 22, 2014
1 parent 811463b commit 31bb88e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions fleetctl/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ func getRegistry(context *cli.Context) *registry.Registry {

func main() {
app := cli.NewApp()
app.Version = version.Version
app.Name = "fleetctl"
app.Usage = "fleetctl is a command line driven interface to the cluster wide CoreOS init system."

Expand All @@ -100,13 +99,19 @@ func main() {
newSSHCommand(),
}

//flagset := flag.NewFlagSet("fleetctl", flag.ExitOnError)
for _, flag := range app.Flags {
flag.Apply(flagset)
for _, f := range app.Flags {
f.Apply(flagset)
}

flagset.Bool("version", false, "Print the version and exit")

flagset.Parse(os.Args[1:])

if (*flagset.Lookup("version")).Value.(flag.Getter).Get().(bool) {
fmt.Println("fleetctl version", version.Version)
os.Exit(0)
}

globalconf.Register("fleetctl", flagset)

opts := globalconf.Options{
Expand Down

0 comments on commit 31bb88e

Please sign in to comment.