Skip to content

Commit

Permalink
feat: Prepare flags for loader
Browse files Browse the repository at this point in the history
  • Loading branch information
h0n9 committed Sep 24, 2024
1 parent 852673f commit 4fbe211
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions cli/tools/loader/loader.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package loader

import (
"fmt"
"math/rand"
"time"

"github.com/spf13/cobra"
)

Expand All @@ -10,11 +14,28 @@ var Cmd = &cobra.Command{
RunE: runE,
}

var (
tlsEnabled bool
hostAddr string
topicID string
nickname string

intervalStr string // "1s"
loadCount int // 0 means unlimited
)

func runE(cmd *cobra.Command, args []string) error {
return nil
}

func init() {
cobra.EnableCommandSorting = false
Cmd.AddCommand()
r := rand.New(rand.NewSource(time.Now().UnixMicro())).Int()

Cmd.Flags().BoolVarP(&tlsEnabled, "tls", "t", false, "enable tls connection")
Cmd.Flags().StringVar(&hostAddr, "host", "localhost:8080", "host addr")
Cmd.Flags().StringVar(&topicID, "topic", "life is beautiful", "topic id")
Cmd.Flags().StringVarP(&nickname, "nickname", "n", fmt.Sprintf("alien-%d", r), "consumer id")

Cmd.Flags().StringVar(&intervalStr, "interval", "1s", "interval")
Cmd.Flags().IntVarP(&loadCount, "count", "c", 100, "load count")
}

0 comments on commit 4fbe211

Please sign in to comment.