Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 9 additions & 17 deletions cli/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func newListVehiclesCommand(cfg *config) *cobra.Command {
if err != nil {
return err
}
printJSON(response)
fmt.Println(protojson.Format(response))
return nil
}
return cmd
Expand All @@ -263,7 +263,7 @@ func newAssignVehiclesCommand(cfg *config) *cobra.Command {
if err != nil {
return err
}
printJSON(response)
fmt.Println(protojson.Format(response))
return nil
}
return cmd
Expand All @@ -287,7 +287,7 @@ func newDeleteVehiclesCommand(cfg *config) *cobra.Command {
if err != nil {
return err
}
printJSON(response)
fmt.Println(protojson.Format(response))
return nil
}
return cmd
Expand All @@ -313,7 +313,7 @@ func newListServicesCommand(cfg *config) *cobra.Command {
if err != nil {
return err
}
printJSON(response)
fmt.Println(protojson.Format(response))
return nil
}
return cmd
Expand Down Expand Up @@ -361,7 +361,7 @@ func newGetVehicleServicesCommand(cfg *config) *cobra.Command {
if err != nil {
return err
}
printJSON(response)
fmt.Println(protojson.Format(response))
return nil
}
return cmd
Expand Down Expand Up @@ -396,7 +396,7 @@ func newActivateVehicleServicesCommand(cfg *config) *cobra.Command {
if err != nil {
return err
}
printJSON(response)
fmt.Println(protojson.Format(response))
return nil
}
return cmd
Expand Down Expand Up @@ -431,7 +431,7 @@ func newDeactivateVehicleServicesCommand(cfg *config) *cobra.Command {
if err != nil {
return err
}
printJSON(response)
fmt.Println(protojson.Format(response))
return nil
}
return cmd
Expand Down Expand Up @@ -464,7 +464,7 @@ func newEnableDeltaPushCommand(cfg *config) *cobra.Command {
if err != nil {
return err
}
printJSON(response)
fmt.Println(protojson.Format(response))
return nil
}
return cmd
Expand Down Expand Up @@ -495,7 +495,7 @@ func newDisableDeltaPushCommand(cfg *config) *cobra.Command {
if err != nil {
return err
}
printJSON(response)
fmt.Println(protojson.Format(response))
return nil
}
return cmd
Expand Down Expand Up @@ -866,14 +866,6 @@ func getExtensionFromContentType(contentType string) string {
}
}

func printJSON(msg any) {
data, err := json.MarshalIndent(msg, "", " ")
if err != nil {
slog.Error("failed to marshal JSON", "error", err)
}
fmt.Println(string(data))
}

type kgoLogger struct {
sl *slog.Logger
}
Expand Down
Loading