committing so i can push so i can show off
still not ready
This commit is contained in:
parent
25501ecdf6
commit
9df33c1ca0
2 changed files with 17 additions and 7 deletions
|
@ -2,6 +2,7 @@ package cmd
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
@ -24,6 +25,10 @@ var (
|
|||
if accountIdentifier == "" {
|
||||
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 {
|
||||
incoming := make(chan client_protocol.BasicResponse)
|
||||
|
@ -36,9 +41,14 @@ var (
|
|||
}
|
||||
|
||||
for msg := range incoming {
|
||||
err := json.NewEncoder(os.Stdout).Encode(msg)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
switch common.OutputFormat {
|
||||
case common.OutputFormatJSON, common.OutputFormatDefault:
|
||||
err := json.NewEncoder(os.Stdout).Encode(msg)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
default:
|
||||
log.Fatal("unsupported output format")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -5,10 +5,10 @@ import (
|
|||
)
|
||||
|
||||
type BasicResponse struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
ErrorType string `json:"error_type,omitempty"`
|
||||
ID string `json:"id,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
ErrorType string `json:"error_type,omitempty"`
|
||||
Error json.RawMessage `json:"error,omitempty"`
|
||||
Data json.RawMessage `json:"data,omitempty"`
|
||||
Account string `json:"account,omitempty"`
|
||||
Account string `json:"account,omitempty"`
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue