cmd

package
v0.0.0-...-4c04542 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "kafka-cli",
	Short: "kafka-cli utility",
	Long: `kafka-cli is a console util tool to access kafka cluster
`,

	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		var err error

		if verbose {
			sarama.Logger = log.New(os.Stderr, "[kafka-cli] ", log.LstdFlags)
		}

		if logAuthMsg {
			fmt.Printf("AuthLog: User: %s, Password: %s, ClientID: %s\n",
				cfg.Net.SASL.User, cfg.Net.SASL.Password, cfg.ClientID)
		}

		addrs := strings.Split(brokers, ",")
		kafkaClient, err = sarama.NewClient(addrs, cfg)
		exitOnError(err)
	},
}

RootCmd represents the base command when called without any subcommands

Functions

func Execute

func Execute()

Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

Types

type Topic

type Topic struct {
	Name         string
	Partitions   []int32   //partition ids
	Replicas     [][]int32 //replica id of partition
	LatestOffset []int64   //latest offset of partition
}

Topic represents a kafka topic

func (Topic) String

func (t Topic) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL