<commit_before>package main

import (
	"github.com/hashicorp/consul/api"
	"github.com/outbrain/consult/misc"
	"github.com/wushilin/stream"
	"gopkg.in/alecthomas/kingpin.v2"
)

type QueryCommand struct {
	Command
	misc.IQuery
	service   string
	tags      []string
	tagsMerge string
}

type queryCommand struct {
	QueryCommand
}

func queryRegisterCli(app *kingpin.Application, opts *appOpts) {
	q := &queryCommand{}
	q.IQuery = q
	q.opts = opts
	queryCmd := app.Command("query", "Query Consul catalog").Action(q.run)
	queryCmd.Flag("tag", "Consul tag").Short('t').StringsVar(&q.tags)
	queryCmd.Flag("service", "Consul service").Required().Short('s').StringVar(&q.service)
	q.registerCli(queryCmd)
}

func (q *queryCommand) run(c *kingpin.ParseContext) error {
	if results, err := q.queryServicesGeneric(); err != nil {
		return err
	} else {
		short := make([]string, 0)
		long := make([]string, 2)
		long[0] = misc.StructHeaderLine(api.CatalogService{})
		long[1] = ""

		for dc, res := range results {<commit_msg>Remove duplicate flag registration<commit_after>package main

import (
	"github.com/hashicorp/consul/api"
	"github.com/outbrain/consult/misc"
	"github.com/wushilin/stream"
	"gopkg.in/alecthomas/kingpin.v2"
)

type QueryCommand struct {
	Command
	misc.IQuery
	service   string
	tags      []string
	tagsMerge string
}

type queryCommand struct {
	QueryCommand
}

func queryRegisterCli(app *kingpin.Application, opts *appOpts) {
	q := &queryCommand{}
	q.IQuery = q
	q.opts = opts
	queryCmd := app.Command("query", "Query Consul catalog").Action(q.run)
	q.registerCli(queryCmd)
}

func (q *queryCommand) run(c *kingpin.ParseContext) error {
	if results, err := q.queryServicesGeneric(); err != nil {
		return err
	} else {
		short := make([]string, 0)
		long := make([]string, 2)
		long[0] = misc.StructHeaderLine(api.CatalogService{})
		long[1] = ""

		for dc, res := range results {
{'fraction_non_alphanumeric': 0.14836325237592396, 'fraction_numerical': 0.005279831045406547, 'mean_word_length': 4.524781341107872, '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': '2379934', 'n_tokens_mistral': 704, 'n_tokens_neox': 675, 'n_words': 145}