I don't know if this is the correct place or not to ask this question.
I am writing a program in GO. I am trying to issue the bx login
command from the program and it fails. I can manually login on the command line and have the GO program issue the bx regions
command successfully.
The GO code is:
tmpapikey := "--apikey " + risapikey
cmd := exec.Command("bx", "login", tmpapikey, "-o", "\"Research Integrated Solutions\"", "-s dev")
cmd.Stdout = &cmdout
cmd.Stderr = &cmderr
fmt.Printf("DEBUG: cmd struct is: %+v
", cmd)
err = cmd.Run()
fmt.Printf("DEBUG: stdout from cmd %s, stderr from cmd %s
",
The command in the exec Command structure is:
bx login --apikey <Real API key> -o "Research Integrated Solutions" -s dev
The error is:
Incorrect Usage.
NAME: login - Log user in
USAGE: bx login [-a API_ENDPOINT] [--sso] [-u USERNAME] [-p PASSWORD] [--apikey KEY | @KEY_FILE] [-c ACCOUNT_ID] [-o ORG] [-s SPACE]
(plus the rest of the help for the bx login
command).
This exact command will work when run from the command line.