<commit_before>package cli

import (
	"io"
	"os"
)
import "fmt"

import "strings"
import "github.com/jwaldrip/odin/cli/values"

// CLI represents a set of defined flags.  The zero value of a FlagSet
// has no name and has ContinueOnError error handling.
type CLI struct {
	ErrorHandling ErrorHandling

	aliases          map[rune]*Flag
	description      string
	errOutput        io.Writer
	flags            flagMap
	flagsTerminated  bool
	flagValues       map[*Flag]values.Value
	fn               func(Command)
	inheritedFlags   flagMap
	name             string
	params           paramsList
	paramValues      map[*Param]values.Value
	paramsParsed     bool
	parent           Command
	propogatingFlags flagMap
	stdOutput        io.Writer
	subCommands      map[string]*SubCommand
	unparsedArgs     values.List
	usage            func()
	version          string
}

func (cmd *CLI) init(name, desc string, fn func(Command), paramNames ...string) {
	cmd.name = name
	cmd.fn = fn
	cmd.description = desc
	cmd.DefineParams(paramNames...)
}

// New returns a new cli with the specified name and
// error handling property.
func New(version, desc string, fn func(Command), paramNames ...string) *CLI {
	nameParts := strings.Split(os.Args[0], "/")
	cli := new(CLI)
	cli.init(nameParts[len(nameParts)-1], desc, fn, paramNames...)
	cli.version = version
	cli.description = desc
	return cli
}

// Alias for New
var NewCLI = New

// Start starts the command with args, arg[0] is ignored
func (cmd *CLI) Start(args ...string) {
	if args == nil {
		args = os.Args
	}

	if len(args) > 1 {
		args = args[1:]
	} else {<commit_msg>exit on error by default<commit_after>package cli

import (
	"io"
	"os"
)
import "fmt"

import "strings"
import "github.com/jwaldrip/odin/cli/values"

// CLI represents a set of defined flags.  The zero value of a FlagSet
// has no name and has ContinueOnError error handling.
type CLI struct {
	ErrorHandling ErrorHandling

	aliases          map[rune]*Flag
	description      string
	errOutput        io.Writer
	flags            flagMap
	flagsTerminated  bool
	flagValues       map[*Flag]values.Value
	fn               func(Command)
	inheritedFlags   flagMap
	name             string
	params           paramsList
	paramValues      map[*Param]values.Value
	paramsParsed     bool
	parent           Command
	propogatingFlags flagMap
	stdOutput        io.Writer
	subCommands      map[string]*SubCommand
	unparsedArgs     values.List
	usage            func()
	version          string
}

func (cmd *CLI) init(name, desc string, fn func(Command), paramNames ...string) {
	cmd.name = name
	cmd.fn = fn
	cmd.description = desc
	cmd.DefineParams(paramNames...)
}

// New returns a new cli with the specified name and
// error handling property.
func New(version, desc string, fn func(Command), paramNames ...string) *CLI {
	nameParts := strings.Split(os.Args[0], "/")
	cli := new(CLI)
	cli.init(nameParts[len(nameParts)-1], desc, fn, paramNames...)
	cli.version = version
	cli.description = desc
	cli.ErrorHandling = ExitOnError
	return cli
}

// Alias for New
var NewCLI = New

// Start starts the command with args, arg[0] is ignored
func (cmd *CLI) Start(args ...string) {
	if args == nil {
		args = os.Args
	}

	if len(args) > 1 {
		args = args[1:]
	} else {
{'fraction_non_alphanumeric': 0.09938650306748466, 'fraction_numerical': 0.003067484662576687, 'mean_word_length': 2.791860465116279, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6359653', 'n_tokens_mistral': 1057, 'n_tokens_neox': 1035, 'n_words': 324}