committing so i can push so i can show off

still not ready
This commit is contained in:
finn 2022-03-18 20:04:43 -07:00
parent 25501ecdf6
commit 9df33c1ca0
2 changed files with 17 additions and 7 deletions

View file

@ -2,6 +2,7 @@ package cmd
import ( import (
"encoding/json" "encoding/json"
"log"
"os" "os"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -24,6 +25,10 @@ var (
if accountIdentifier == "" { if accountIdentifier == "" {
accountIdentifier = config.Config.DefaultAccount accountIdentifier = config.Config.DefaultAccount
} }
if accountIdentifier == "" {
common.Must(cmd.Help())
log.Fatal("No account specified. Please specify with --account or set a default")
}
}, },
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
incoming := make(chan client_protocol.BasicResponse) incoming := make(chan client_protocol.BasicResponse)
@ -36,10 +41,15 @@ var (
} }
for msg := range incoming { for msg := range incoming {
switch common.OutputFormat {
case common.OutputFormatJSON, common.OutputFormatDefault:
err := json.NewEncoder(os.Stdout).Encode(msg) err := json.NewEncoder(os.Stdout).Encode(msg)
if err != nil { if err != nil {
panic(err) panic(err)
} }
default:
log.Fatal("unsupported output format")
}
} }
return nil return nil
}, },