<commit_before>package mc

import (
	"fmt"
	"os"

	"github.com/codegangsta/cli"
	"github.com/parnurzeal/gorequest"
	"github.com/materials-commons/mcstore/pkg/app"
	"github.com/materials-commons/mcstore/server/mcstore"
)

var projectStatusCommand = cli.Command{
	Name:    "status",
	Aliases: []string{"s", "stat"},
	Usage:   "List status of project",
	Flags: []cli.Flag{
		cli.BoolTFlag{
			Name:  "uploads, u",
			Usage: "Display outstanding upload requests.",
		},
		cli.BoolFlag{
			Name:  "all, a",
			Usage: "Display all status information",
		},
		cli.BoolFlag{
			Name:  "changes, c",
			Usage: "Display all file changes",
		},
	},
	Action: projectStatusCLI,
}

type projectStatusCommandState struct {
	client *gorequest.SuperAgent
}

func projectStatusCLI(c *cli.Context) {
	if len(c.Args()) != 1 {
		fmt.Println("You must specify a project name.")
		os.Exit(1)
	}

	proj := c.Args()[0]
	s := &projectStatusCommandState{
		client: newGoRequest(),
	}

	switch {
	case c.Bool("all"):
		s.displayStatusAll(proj)
	case c.Bool("uploads"):
		s.displayStatusUploads(proj)
	case c.Bool("changes"):
		s.displayStatusFileChanges(proj)
	}
}

func (s *projectStatusCommandState) displayStatusAll(project string) {
	s.displayStatusUploads(project)
	s.displayStatusFileChanges(project)
}

func (s *projectStatusCommandState) displayStatusUploads(project string) {
	if uploads, err := s.getUploads(project); err != nil {
		fmt.Println("Failed retrieving uploads for project: %s", err)
	} else {
		fmt.Printf("%#v\n", uploads)
	}
}

func (s *projectStatusCommandState) getUploads(project string) ([]mcstore.UploadEntry, error) {
	r, body, errs := s.client.Get("").End()
	if err := app.MCApi.APIError(r, errs); err != nil {
		return nil, err
	}

	var uploads []mcstore.UploadEntry
	app.MCApi.ToJSON(body, &uploads)
	return uploads, nil
}

func (s *projectStatusCommandState) displayStatusFileChanges(project string) {
	fmt.Println("file changes not yet implemented")
	os.Exit(1)
}
<commit_msg>gofmt.<commit_after>package mc

import (
	"fmt"
	"os"

	"github.com/codegangsta/cli"
	"github.com/materials-commons/mcstore/pkg/app"
	"github.com/materials-commons/mcstore/server/mcstore"
	"github.com/parnurzeal/gorequest"
)

var projectStatusCommand = cli.Command{
	Name:    "status",
	Aliases: []string{"s", "stat"},
	Usage:   "List status of project",
	Flags: []cli.Flag{
		cli.BoolTFlag{
			Name:  "uploads, u",
			Usage: "Display outstanding upload requests.",
		},
		cli.BoolFlag{
			Name:  "all, a",
			Usage: "Display all status information",
		},
		cli.BoolFlag{
			Name:  "changes, c",
			Usage: "Display all file changes",
		},
	},
	Action: projectStatusCLI,
}

type projectStatusCommandState struct {
	client *gorequest.SuperAgent
}

func projectStatusCLI(c *cli.Context) {
	if len(c.Args()) != 1 {
		fmt.Println("You must specify a project name.")
		os.Exit(1)
	}

	proj := c.Args()[0]
	s := &projectStatusCommandState{
		client: newGoRequest(),
	}

	switch {
	case c.Bool("all"):
		s.displayStatusAll(proj)
	case c.Bool("uploads"):
		s.displayStatusUploads(proj)
	case c.Bool("changes"):
		s.displayStatusFileChanges(proj)
	}
}

func (s *projectStatusCommandState) displayStatusAll(project string) {
	s.displayStatusUploads(project)
	s.displayStatusFileChanges(project)
}

func (s *projectStatusCommandState) displayStatusUploads(project string) {
	if uploads, err := s.getUploads(project); err != nil {
		fmt.Println("Failed retrieving uploads for project: %s", err)
	} else {
		fmt.Printf("%#v\n", uploads)
	}
}

func (s *projectStatusCommandState) getUploads(project string) ([]mcstore.UploadEntry, error) {
	r, body, errs := s.client.Get("").End()
	if err := app.MCApi.APIError(r, errs); err != nil {
		return nil, err
	}

	var uploads []mcstore.UploadEntry
	app.MCApi.ToJSON(body, &uploads)
	return uploads, nil
}

func (s *projectStatusCommandState) displayStatusFileChanges(project string) {
	fmt.Println("file changes not yet implemented")
	os.Exit(1)
}

{'fraction_non_alphanumeric': 0.14877494316746653, 'fraction_numerical': 0.002020712301086133, 'mean_word_length': 4.625, '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': '3488645', 'n_tokens_mistral': 1505, 'n_tokens_neox': 1428, 'n_words': 308}