You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: cmd/kaf/consume.go
+102-18
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,10 @@ import (
6
6
"encoding/binary"
7
7
"encoding/json"
8
8
"fmt"
9
+
"strconv"
9
10
"sync"
10
11
"text/tabwriter"
11
12
12
-
"strconv"
13
-
14
13
"github.com/Shopify/sarama"
15
14
"github.com/birdayz/kaf/pkg/avro"
16
15
"github.com/birdayz/kaf/pkg/proto"
@@ -24,11 +23,13 @@ var (
24
23
offsetFlagstring
25
24
groupFlagstring
26
25
groupCommitFlagbool
27
-
rawbool
28
-
followbool
29
-
tailint32
30
-
schemaCache*avro.SchemaCache
31
-
keyfmt*prettyjson.Formatter
26
+
outputFormat=OutputFormatDefault
27
+
// Deprecated: Use outputFormat instead.
28
+
rawbool
29
+
followbool
30
+
tailint32
31
+
schemaCache*avro.SchemaCache
32
+
keyfmt*prettyjson.Formatter
32
33
33
34
protoTypestring
34
35
keyProtoTypestring
@@ -44,6 +45,7 @@ func init() {
44
45
rootCmd.AddCommand(consumeCmd)
45
46
consumeCmd.Flags().StringVar(&offsetFlag, "offset", "oldest", "Offset to start consuming. Possible values: oldest, newest, or integer.")
46
47
consumeCmd.Flags().BoolVar(&raw, "raw", false, "Print raw output of messages, without key or prettified JSON")
48
+
consumeCmd.Flags().Var(&outputFormat, "output", "Set output format messages: default, raw (without key or prettified JSON), json")
47
49
consumeCmd.Flags().BoolVarP(&follow, "follow", "f", false, "Continue to consume messages until program execution is interrupted/terminated")
48
50
consumeCmd.Flags().Int32VarP(&tail, "tail", "n", 0, "Print last n messages per partition")
49
51
consumeCmd.Flags().StringSliceVar(&protoFiles, "proto-include", []string{}, "Path to proto files")
@@ -56,6 +58,14 @@ func init() {
56
58
consumeCmd.Flags().StringVarP(&groupFlag, "group", "g", "", "Consumer Group to use for consume")
57
59
consumeCmd.Flags().BoolVar(&groupCommitFlag, "commit", false, "Commit Group offset after receiving messages. Works only if consuming as Consumer Group")
0 commit comments