<commit_before>// Command juggler-client can be used to send commands to a juggler
// server.
package main

import (
	"flag"
	"fmt"
	"io"
	"log"
	"os"
	"strings"
	"time"

	"golang.org/x/crypto/ssh/terminal"
)

const welcomeMessage = `
Welcome to the juggler client. Enter ? or help for the available
commands. Press ^D (ctrl-D) to exit.
`

var (
	term *terminal.Terminal
)

var (
	defaultConnFlag     = flag.String("addr", "ws://localhost:9000/ws", "default dial address to use in connect commands")
	defaultSubprotoFlag = flag.String("subprotocol", "juggler.0", "default subprotocol to request in the websocket handshake")
	timestampFmtFlag    = flag.String("timestamp", time.StampMilli, "format of the timestamp in the output, empty for none")
)

func main() {
	var exitCode int

	flag.Parse()

	// call os.Exit in a defer, otherwise defer to reset the terminal
	// will not be run.
	defer func() {
		if exitCode != 0 {
			os.Exit(exitCode)
		}
	}()

	// setup and restore the terminal
	t, fn := setupTerminal()
	defer fn()
	term = t

	printfTs(welcomeMessage, "")
	for {
		l, err := t.ReadLine()
		if err != nil {
			if err == io.EOF {
				return
			}
			printErr("failed to read line: %v", err)
			exitCode = 1
			return
		}
<commit_msg>juggler/cmd: clean-up flag description in juggler-client<commit_after>// Command juggler-client can be used to send commands to a juggler
// server.
package main

import (
	"flag"
	"fmt"
	"io"
	"log"
	"os"
	"strings"
	"time"

	"golang.org/x/crypto/ssh/terminal"
)

const welcomeMessage = `
Welcome to the juggler client. Enter ? or help for the available
commands. Press ^D (ctrl-D) to exit.
`

var (
	term *terminal.Terminal
)

var (
	defaultConnFlag     = flag.String("addr", "ws://localhost:9000/ws", "Default server `address` used in connect command.")
	defaultSubprotoFlag = flag.String("proto", "juggler.0", "Default `subprotocol` used in connect command.")
	timestampFmtFlag    = flag.String("timestamp", time.StampMilli, "Timestamp `format`, using Go time format syntax.")
	helpFlag            = flag.Bool("help", false, "Show help.")
)

func main() {
	var exitCode int

	flag.Parse()
	if *helpFlag {
		flag.Usage()
		return
	}

	// call os.Exit in a defer, otherwise defer to reset the terminal
	// will not be run.
	defer func() {
		if exitCode != 0 {
			os.Exit(exitCode)
		}
	}()

	// setup and restore the terminal
	t, fn := setupTerminal()
	defer fn()
	term = t

	printfTs(welcomeMessage, "")
	for {
		l, err := t.ReadLine()
		if err != nil {
			if err == io.EOF {
				return
			}
			printErr("failed to read line: %v", err)
			exitCode = 1
			return
		}

{'fraction_non_alphanumeric': 0.1310344827586207, 'fraction_numerical': 0.0053639846743295016, 'mean_word_length': 3.2733224222585924, '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': '7027357', 'n_tokens_mistral': 978, 'n_tokens_neox': 899, 'n_words': 292}