<commit_before>package commands

import (
	"fmt"
	"os"
	"os/exec"
	"strings"

	"github.com/phase2/rig/cli/util"
	"github.com/urfave/cli"
)

type ProjectCreate struct {
	BaseCommand
}

func (cmd *ProjectCreate) Commands() []cli.Command {
	create := cli.Command{
		Name:        "create",
		Aliases:     []string{},
		Usage:       "Run a yeoman generator in a container to create project configuration files",
		ArgsUsage:   "[optional type] [optional args]",
		Description: "The type is the generator to run with args passed to that generator. If using flag arguments use -- before specifying type and arguments.",
		Flags: []cli.Flag{
			cli.StringFlag{
				Name:  "image",
				Usage: "Docker image to use if default outrigger/generator is not desired",
			},
		},
		Before:      cmd.Before,
		Action:      cmd.Create,
	}

	return []cli.Command{create}
}

// Run a docker image to execute the desired generator
func (cmd *ProjectCreate) Create(ctx *cli.Context) error {
	image := ctx.String("image")
	if (image == "") {
		image = "outrigger/generator"
	}

	cwd, err := os.Getwd();
	if (err != nil) {
		cmd.out.Error.Printf("Couldn't determine current working directory: %s", err)
		os.Exit(1)
	}

	cmd.out.Verbose.Printf("Executing container %s with arguments %s", image, strings.Join(ctx.Args(), " "))

	// keep passed in args as distinct elements or they will be treated as
	// a single argument containing spaces when the container gets them
	args := []string{
		"run",
		"--rm",
		"-it",
		"-v", fmt.Sprintf("%s:/generated", cwd),
		image,
		"yo", "--no-insight",
	}
	args = append(args, ctx.Args()...)

	shellCmd := exec.Command("docker", args...)
	if exitCode := util.PassthruCommand(shellCmd); exitCode != 0 {
		cmd.out.Error.Printf("Error running generator '%s %s': %d", image, strings.Join(ctx.Args(), " "), exitCode)
		os.Exit(exitCode)
	}

	return nil
}<commit_msg>DEVTOOLS-229 Updates based on code review and to match expected generator input<commit_after>package commands

import (
	"fmt"
	"os"
	"os/exec"
	"strings"

	"github.com/phase2/rig/cli/util"
	"github.com/urfave/cli"
)

type ProjectCreate struct {
	BaseCommand
}

func (cmd *ProjectCreate) Commands() []cli.Command {
	create := cli.Command{
		Name:        "create",
		Aliases:     []string{},
		Usage:       "Run a code generator to generate scaffolding for a new project.",
		ArgsUsage:   "[optional type] [optional args]",
		Description: "The type is the generator to run with args passed to that generator. If using flag arguments use -- before specifying type and arguments.",
		Flags: []cli.Flag{
			cli.StringFlag{
				Name:  "image",
				Usage: "Docker image to use if default outrigger/generator is not desired",
			},
		},
		Before:      cmd.Before,
		Action:      cmd.Create,
	}

	return []cli.Command{create}
}

// Run a docker image to execute the desired generator
func (cmd *ProjectCreate) Create(ctx *cli.Context) error {
	image := ctx.String("image")
	if (image == "") {
		image = "outrigger/generator"
	}

	cwd, err := os.Getwd();
	if (err != nil) {
		cmd.out.Error.Printf("Couldn't determine current working directory: %s", err)
		os.Exit(1)
	}

	cmd.out.Verbose.Printf("Executing container %s with arguments %s", image, strings.Join(ctx.Args(), " "))

	// keep passed in args as distinct elements or they will be treated as
	// a single argument containing spaces when the container gets them
	args := []string{
		"run",
		"--rm",
		"-it",
		"-v", fmt.Sprintf("%s:/generated", cwd),
		image,
	}

	args = append(args, ctx.Args()...)

	shellCmd := exec.Command("docker", args...)
	if exitCode := util.PassthruCommand(shellCmd); exitCode != 0 {
		cmd.out.Error.Printf("Error running generator %s %s: %d", image, strings.Join(ctx.Args(), " "), exitCode)
		os.Exit(exitCode)
	}

	return nil
}
{'fraction_non_alphanumeric': 0.1489812119608362, 'fraction_numerical': 0.0023815824292140776, 'mean_word_length': 3.570737605804111, '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': '1053051', 'n_tokens_mistral': 1327, 'n_tokens_neox': 1235, 'n_words': 384}