| 204 | } |
| 205 | |
| 206 | func TestExecuteExitHelper(t *testing.T) { |
| 207 | if os.Getenv("DBXCLI_TEST_EXECUTE_HELPER") != "1" { |
| 208 | return |
| 209 | } |
| 210 | |
| 211 | separator := -1 |
| 212 | for i, arg := range os.Args { |
| 213 | if arg == "--" { |
| 214 | separator = i |
| 215 | break |
| 216 | } |
| 217 | } |
| 218 | if separator < 0 { |
| 219 | os.Exit(exitCodeGenericError) |
| 220 | } |
| 221 | |
| 222 | args := append([]string(nil), os.Args[separator+1:]...) |
| 223 | os.Args = append([]string{"dbxcli"}, args...) |
| 224 | RootCmd.SetArgs(args) |
| 225 | Execute() |
| 226 | os.Exit(exitCodeSuccess) |
| 227 | } |
| 228 | |
| 229 | func newAuthTestCommand() *cobra.Command { |
| 230 | root := &cobra.Command{Use: "dbxcli"} |