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

Commit

Permalink
Merge pull request #748 from rbradford/parse-commands-before-tenant-s…
Browse files Browse the repository at this point in the history
…etup

ciao-cli: Parse the subcommand before identifying with keystone
  • Loading branch information
Tim Pepper authored Oct 26, 2016
2 parents 06ddec9 + ab06400 commit cb53cb7
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions ciao-cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func (c *command) run(args []string) error {
c.usage(cmdName)
}
args = subCmd.parseArgs(args[2:])
prepareForCommand()
return subCmd.run(args)
}

Expand Down Expand Up @@ -341,21 +342,8 @@ func checkCompulsoryOptions() {
}
}

func main() {
func prepareForCommand() {
var err error

flag.Usage = usage
flag.Parse()

getCiaoEnvVariables()
checkCompulsoryOptions()

// Print usage if no arguments are given
args := flag.Args()
if len(args) < 1 {
usage()
}

/* Load CA file if necessary */
if *caCertFile != "" {
caCert, err := ioutil.ReadFile(*caCertFile)
Expand All @@ -382,6 +370,22 @@ func main() {
if err != nil {
fatalf(err.Error())
}
}

func main() {
var err error

flag.Usage = usage
flag.Parse()

getCiaoEnvVariables()
checkCompulsoryOptions()

// Print usage if no arguments are given
args := flag.Args()
if len(args) < 1 {
usage()
}

// Find command in cmdline args
cmdName := args[0]
Expand Down

0 comments on commit cb53cb7

Please sign in to comment.