<commit_before>package terminal

import (
	"cf/configuration"
	"fmt"
	"github.com/codegangsta/cli"
	"os"
	"strings"
	"time"
)

type ColoringFunction func(value string, row int, col int) string

func NotLoggedInText() string {
	return fmt.Sprintf("Not logged in. Use '%s' to log in.", CommandColor("cf login"))
}

type UI interface {
	Say(message string, args ...interface{})
	Ask(prompt string, args ...interface{}) (answer string)
	AskForPassword(prompt string, args ...interface{}) (answer string)
	Ok()
	Failed(message string)
	FailWithUsage(ctxt *cli.Context, cmdName string)
	ShowConfiguration(*configuration.Configuration)
	LoadingIndication()
	Wait(duration time.Duration)
	DisplayTable(table [][]string, coloringFunc ColoringFunction)
}

type TerminalUI struct {
}

func (c TerminalUI) Say(message string, args ...interface{}) {
	fmt.Printf(message+"\n", args...)
	return
}

func (c TerminalUI) Ask(prompt string, args ...interface{}) (answer string) {
	fmt.Println("")
	fmt.Printf(prompt+" ", args...)
	fmt.Scanln(&answer)
	return
}

func (c TerminalUI) Ok() {
	c.Say(SuccessColor("OK"))
}

func (c TerminalUI) Failed(message string) {
	c.Say(FailureColor("FAILED"))
	c.Say(message)
	os.Exit(1)
}

func (c TerminalUI) FailWithUsage(ctxt *cli.Context, cmdName string) {
	c.Failed("Incorrect Usage.\n")
	cli.ShowCommandHelp(ctxt, cmdName)
	c.Say("")
	os.Exit(1)
}

func (ui TerminalUI) ShowConfiguration(config *configuration.Configuration) {
	ui.Say("API endpoint: %s (API version: %s)",
		EntityNameColor(config.Target),
		EntityNameColor(config.ApiVersion))

	if !config.IsLoggedIn() {
		ui.Say("Logged out. Use '%s' to login.", CommandColor("cf login USERNAME"))
	} else {<commit_msg>FailWithUsage was exiting before printing usage [#57263322]<commit_after>package terminal

import (
	"cf/configuration"
	"fmt"
	"github.com/codegangsta/cli"
	"os"
	"strings"
	"time"
)

type ColoringFunction func(value string, row int, col int) string

func NotLoggedInText() string {
	return fmt.Sprintf("Not logged in. Use '%s' to log in.", CommandColor("cf login"))
}

type UI interface {
	Say(message string, args ...interface{})
	Ask(prompt string, args ...interface{}) (answer string)
	AskForPassword(prompt string, args ...interface{}) (answer string)
	Ok()
	Failed(message string)
	FailWithUsage(ctxt *cli.Context, cmdName string)
	ShowConfiguration(*configuration.Configuration)
	LoadingIndication()
	Wait(duration time.Duration)
	DisplayTable(table [][]string, coloringFunc ColoringFunction)
}

type TerminalUI struct {
}

func (c TerminalUI) Say(message string, args ...interface{}) {
	fmt.Printf(message+"\n", args...)
	return
}

func (c TerminalUI) Ask(prompt string, args ...interface{}) (answer string) {
	fmt.Println("")
	fmt.Printf(prompt+" ", args...)
	fmt.Scanln(&answer)
	return
}

func (c TerminalUI) Ok() {
	c.Say(SuccessColor("OK"))
}

func (c TerminalUI) Failed(message string) {
	c.Say(FailureColor("FAILED"))
	c.Say(message)
	os.Exit(1)
}

func (c TerminalUI) FailWithUsage(ctxt *cli.Context, cmdName string) {
	c.Say(FailureColor("FAILED"))
	c.Say("Incorrect Usage.\n")
	cli.ShowCommandHelp(ctxt, cmdName)
	c.Say("")
	os.Exit(1)
}

func (ui TerminalUI) ShowConfiguration(config *configuration.Configuration) {
	ui.Say("API endpoint: %s (API version: %s)",
		EntityNameColor(config.Target),
		EntityNameColor(config.ApiVersion))

	if !config.IsLoggedIn() {
		ui.Say("Logged out. Use '%s' to login.", CommandColor("cf login USERNAME"))
	} else {
{'fraction_non_alphanumeric': 0.1558891454965358, 'fraction_numerical': 0.003464203233256351, 'mean_word_length': 5.232014388489208, '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': '4587370', 'n_tokens_mistral': 1210, 'n_tokens_neox': 1161, 'n_words': 295}