<commit_before>package commands

import (
	"fmt"

	"github.com/evandbrown/dm/conf"
	"github.com/evandbrown/dm/util"
	"github.com/spf13/cobra"
)

var lsCmd = &cobra.Command{
	Use:   "ls",
	Short: "List deployments",
}

func init() {
	lsCmd.PreRun = func(cmd *cobra.Command, args []string) {
		requireConfig()
	}
	lsCmd.Run = func(cmd *cobra.Command, args []string) {
		util.Check(ls(cmd, args))
	}
}

func ls(cmd *cobra.Command, args []string) error {
	config, _ := conf.ReadDeploymentConfig()

	for _, c := range config.Deployments {
		fmt.Printf("%s\n", c.Id)
	}
	return nil
}
<commit_msg>Write deployment state<commit_after>package commands

import (
	"fmt"
	"os"
	"text/tabwriter"

	"github.com/evandbrown/dm/conf"
	"github.com/evandbrown/dm/googlecloud"
	"github.com/evandbrown/dm/util"
	"github.com/spf13/cobra"
)

var lsCmd = &cobra.Command{
	Use:   "ls",
	Short: "List deployments",
}

func init() {
	lsCmd.PreRun = func(cmd *cobra.Command, args []string) {
		requireConfig()
	}
	lsCmd.Run = func(cmd *cobra.Command, args []string) {
		util.Check(ls(cmd, args))
	}
}

func ls(cmd *cobra.Command, args []string) error {
	// Get config from disk
	config, _ := conf.ReadDeploymentConfig()

	// Get service
	service, err := googlecloud.GetService()
	util.Check(err)

	w := new(tabwriter.Writer)
	w.Init(os.Stdout, 0, 8, 2, '\t', 0)
	fmt.Fprintln(w, "Deployment Name\tProject\tState\t")
	for _, c := range config.Deployments {
		call := service.Deployments.Get(c.Project, c.Id)
		deployment, error := call.Do()
		util.Check(error)
		fmt.Fprintf(w, "%s\t%s\t%s\t\n", c.Id, c.Project, deployment.State)
	}
	w.Flush()
	return nil
}

{'fraction_non_alphanumeric': 0.17351318209687308, 'fraction_numerical': 0.004904966278356836, 'mean_word_length': 3.9908256880733943, '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': '5645967', 'n_tokens_mistral': 702, 'n_tokens_neox': 673, 'n_words': 129}