<commit_before>package command

import (
	"fmt"
	"time"

	"github.com/codegangsta/cli"
)

func NewLastseenCommand() cli.Command {
	cmd := cli.Command{
		Name: "lastseen",
		Usage: "show when minion(s) were last seen",
		Action: execLastseenCommand,
	}

	return cmd
}

// Executes the "lastseen" command
func execLastseenCommand(c *cli.Context) {
	client := newEtcdMinionClientFromFlags(c)
	minions, err := client.MinionList()

	if err != nil {
		displayError(err, 1)
	}

	for _, minion := range minions {
		lastseen, err := client.MinionLastseen(minion)
		if err != nil {
			displayError(err, 1)
		}

		fmt.Printf("%s\t%s\n", minion, time.Unix(lastseen, 0))
	}
}
<commit_msg>gructl: lastseen command accepts --with-classifier flag<commit_after>package command

import (
	"fmt"
	"time"

	"github.com/codegangsta/cli"
)

func NewLastseenCommand() cli.Command {
	cmd := cli.Command{
		Name: "lastseen",
		Usage: "show when minion(s) were last seen",
		Action: execLastseenCommand,
		Flags: []cli.Flag{
			cli.StringFlag{
				Name: "with-classifier",
				Value: "",
				Usage: "match minions with given classifier pattern",
			},
		},
	}

	return cmd
}

// Executes the "lastseen" command
func execLastseenCommand(c *cli.Context) {
	client := newEtcdMinionClientFromFlags(c)

	cFlag := c.String("with-classifier")
	minions, err := parseClassifierPattern(client, cFlag)

	if err != nil {
		displayError(err, 1)
	}

	for _, minion := range minions {
		lastseen, err := client.MinionLastseen(minion)
		if err != nil {
			displayError(err, 1)
		}

		fmt.Printf("%s\t%s\n", minion, time.Unix(lastseen, 0))
	}
}

{'fraction_non_alphanumeric': 0.14232209737827714, 'fraction_numerical': 0.003745318352059925, 'mean_word_length': 3.9937694704049846, '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': '4991969', 'n_tokens_mistral': 647, 'n_tokens_neox': 593, 'n_words': 135}