<commit_before>package main

import (
	"strings"

	"github.com/spf13/cobra"

	"github.com/apex/log"
)

type DeployCmdLocalValues struct {
	names []string
}

const deployCmdExample = `  Deploy all functions
  $ apex deploy

  Deploy specific functions
  $ apex deploy foo bar

  Deploy functions in a different project
  $ apex deploy -C ~/dev/myapp`

var deployCmd = &cobra.Command{
	Use:     "deploy [<name>...]",
	Short:   "Deploy code and config changes",
	Example: deployCmdExample,
	PreRun:  deployCmdPreRun,
	Run:     deployCmdRun,
}

var deployCmdLocalValues = DeployCmdLocalValues{}

func deployCmdPreRun(c *cobra.Command, args []string) {
	lv := &deployCmdLocalValues

	if len(args) == 0 {
		lv.names = pv.project.FunctionNames()
		return
	}
	lv.names = args
}

func deployCmdRun(c *cobra.Command, args []string) {
	lv := &deployCmdLocalValues

	for _, s := range pv.Env {
		parts := strings.Split(s, "=")
		pv.project.SetEnv(parts[0], parts[1])
	}

	if err := pv.project.DeployAndClean(lv.names); err != nil {
		log.Fatalf("error: %s", err)
	}
}<commit_msg>add deploy -c, --concurrency. Closes #46<commit_after>package main

import (
	"strings"

	"github.com/spf13/cobra"

	"github.com/apex/log"
)

type DeployCmdLocalValues struct {
	concurrency int
	names       []string
}

const deployCmdExample = `  Deploy all functions
  $ apex deploy

  Deploy specific functions
  $ apex deploy foo bar

  Deploy functions in a different project
  $ apex deploy -C ~/dev/myapp`

var deployCmd = &cobra.Command{
	Use:     "deploy [<name>...]",
	Short:   "Deploy code and config changes",
	Example: deployCmdExample,
	PreRun:  deployCmdPreRun,
	Run:     deployCmdRun,
}

var deployCmdLocalValues = DeployCmdLocalValues{}

func init() {
	lv := &deployCmdLocalValues
	f := deployCmd.Flags()

	f.IntVarP(&lv.concurrency, "concurrency", "c", 5, "Concurrent deploys")
}

func deployCmdPreRun(c *cobra.Command, args []string) {
	lv := &deployCmdLocalValues

	if len(args) == 0 {
		lv.names = pv.project.FunctionNames()
		return
	}
	lv.names = args
}

func deployCmdRun(c *cobra.Command, args []string) {
	lv := &deployCmdLocalValues

	pv.project.Concurrency = lv.concurrency

	for _, s := range pv.Env {
		parts := strings.Split(s, "=")
		pv.project.SetEnv(parts[0], parts[1])
	}

	if err := pv.project.DeployAndClean(lv.names); err != nil {
		log.Fatalf("error: %s", err)
	}
}
{'fraction_non_alphanumeric': 0.13544303797468354, 'fraction_numerical': 0.005485232067510549, 'mean_word_length': 3.888659793814433, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7184801', 'n_tokens_mistral': 911, 'n_tokens_neox': 857, 'n_words': 209}