<commit_before>package command

import (
	"flag"
	"fmt"
	"strings"
	"time"

	"github.com/funkygao/columnize"
	czk "github.com/funkygao/dbus/pkg/checkpoint/store/zk"
	"github.com/funkygao/gafka/ctx"
	"github.com/funkygao/gafka/zk"
	"github.com/funkygao/gocli"
)

type Checkpoint struct {
	Ui  cli.Ui
	Cmd string
}

func (this *Checkpoint) Run(args []string) (exitCode int) {
	var (
		zone    string
		topMode bool
	)
	cmdFlags := flag.NewFlagSet("checkpoint", flag.ContinueOnError)
	cmdFlags.Usage = func() { this.Ui.Output(this.Help()) }
	cmdFlags.StringVar(&zone, "z", ctx.ZkDefaultZone(), "")
	cmdFlags.BoolVar(&topMode, "top", false, "")
	if err := cmdFlags.Parse(args); err != nil {
		return 1
	}

	zkzone := zk.NewZkZone(zk.DefaultConfig(zone, ctx.ZoneZkAddrs(zone)))
	mgr := czk.NewManager(zkzone)
	states, err := mgr.AllStates()
	if err != nil {
		this.Ui.Error(err.Error())
		return 2
	}

	for {
		lines := []string{"Scheme|DSN|Position"}
		for _, state := range states {<commit_msg>fix bug: didn't feed the states data<commit_after>package command

import (
	"flag"
	"fmt"
	"strings"
	"time"

	"github.com/funkygao/columnize"
	czk "github.com/funkygao/dbus/pkg/checkpoint/store/zk"
	"github.com/funkygao/gafka/ctx"
	"github.com/funkygao/gafka/zk"
	"github.com/funkygao/gocli"
)

type Checkpoint struct {
	Ui  cli.Ui
	Cmd string
}

func (this *Checkpoint) Run(args []string) (exitCode int) {
	var (
		zone    string
		topMode bool
	)
	cmdFlags := flag.NewFlagSet("checkpoint", flag.ContinueOnError)
	cmdFlags.Usage = func() { this.Ui.Output(this.Help()) }
	cmdFlags.StringVar(&zone, "z", ctx.ZkDefaultZone(), "")
	cmdFlags.BoolVar(&topMode, "top", false, "")
	if err := cmdFlags.Parse(args); err != nil {
		return 1
	}

	zkzone := zk.NewZkZone(zk.DefaultConfig(zone, ctx.ZoneZkAddrs(zone)))
	mgr := czk.NewManager(zkzone)

	for {
		states, err := mgr.AllStates()
		if err != nil {
			this.Ui.Error(err.Error())
			return 2
		}

		lines := []string{"Scheme|DSN|Position"}
		for _, state := range states {
{'fraction_non_alphanumeric': 0.1650919940328195, 'fraction_numerical': 0.001989060169070114, 'mean_word_length': 4.172236503856041, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4485801', 'n_tokens_mistral': 834, 'n_tokens_neox': 800, 'n_words': 150}