<commit_before>package commands

import (
	"errors"
	"fmt"

	"github.com/concourse/fly/rc"
	"github.com/concourse/go-concourse/concourse"
	"github.com/vito/go-interact/interact"
)

type DestroyTeamCommand struct {
	TeamName string `short:"n" long:"team-name" required:"true"        description:"The team to delete"`
}

func (command *DestroyTeamCommand) Execute([]string) error {
	target, err := rc.LoadTarget(Fly.Target)
	if err != nil {
		return err
	}

	err = target.Validate()
	if err != nil {
		return err
	}

	teamName := command.TeamName
	fmt.Printf("!!! this will remove all data for team `%s`\n\n", teamName)

	var confirm string
	err = interact.NewInteraction("are you sure? please type the team name to continue:").Resolve(interact.Required(&confirm))
	if err != nil {
		return err
	}
	if confirm != teamName {
		return errors.New("you typed in the team name incorrectly, bailing out")
	}

	err = target.Team().DestroyTeam(teamName)
	switch err {
	case nil:
		fmt.Printf("%s has been destroyed\n", teamName)
		return nil
	case concourse.ErrDestroyRefused:
		fmt.Printf("only admin can delete teams\n")
		return err
	default:
		fmt.Printf("delete failed due to server error\n")
		return err
	}
}<commit_msg>terser verbiage<commit_after>package commands

import (
	"errors"
	"fmt"

	"github.com/concourse/fly/rc"
	"github.com/concourse/go-concourse/concourse"
	"github.com/vito/go-interact/interact"
)

type DestroyTeamCommand struct {
	TeamName string `short:"n" long:"team-name" required:"true"        description:"The team to delete"`
}

func (command *DestroyTeamCommand) Execute([]string) error {
	target, err := rc.LoadTarget(Fly.Target)
	if err != nil {
		return err
	}

	err = target.Validate()
	if err != nil {
		return err
	}

	teamName := command.TeamName
	fmt.Printf("!!! this will remove all data for team `%s`\n\n", teamName)

	var confirm string
	err = interact.NewInteraction("are you sure? please type the team name to continue:").Resolve(interact.Required(&confirm))
	if err != nil {
		return err
	}

	if confirm != teamName {
		return errors.New("incorrect team name; bailing out")
	}

	err = target.Team().DestroyTeam(teamName)
	switch err {
	case nil:
		fmt.Printf("%s has been destroyed\n", teamName)
		return nil
	case concourse.ErrDestroyRefused:
		fmt.Printf("only admin can delete teams\n")
		return err
	default:
		fmt.Printf("delete failed due to server error\n")
		return err
	}
}
{'fraction_non_alphanumeric': 0.12655086848635236, 'fraction_numerical': 0.0, 'mean_word_length': 4.157782515991471, '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': '7452612', 'n_tokens_mistral': 837, 'n_tokens_neox': 813, 'n_words': 227}