From 33942b4759ea36384bc6c2ad816e95bb91b8038c Mon Sep 17 00:00:00 2001 From: Ben Selby Date: Tue, 25 May 2021 13:03:00 +0100 Subject: [PATCH] Convert over to Cobra CLI framework --- .github/workflows/go.yml | 6 - .gitignore | 3 - CHANGELOG.md | 9 ++ README.md | 46 +++--- build.go | 132 ---------------- cmd/build.go | 97 ++++++++++++ cmd/code.go | 69 +++++++++ cmd/delivery_plan.go | 137 +++++++++++++++++ cmd/iteration.go | 316 +++++++++++++++++++++++++++++++++++++ cmd/pull_request.go | 91 +++++++++++ cmd/root.go | 90 +++++++++++ cmd/team.go | 57 +++++++ code.go | 51 ------ delivery_plan.go | 120 --------------- go.mod | 8 +- go.sum | 325 ++++++++++++++++++++++++++++++++++++++- iteration.go | 247 ----------------------------- main.go | 190 +---------------------- pull_request.go | 72 --------- sonar-project.properties | 13 -- team.go | 37 ----- ui/ui.go | 12 ++ 22 files changed, 1231 insertions(+), 897 deletions(-) create mode 100644 CHANGELOG.md delete mode 100644 build.go create mode 100644 cmd/build.go create mode 100644 cmd/code.go create mode 100644 cmd/delivery_plan.go create mode 100644 cmd/iteration.go create mode 100644 cmd/pull_request.go create mode 100644 cmd/root.go create mode 100644 cmd/team.go delete mode 100644 code.go delete mode 100644 delivery_plan.go delete mode 100644 iteration.go delete mode 100644 pull_request.go delete mode 100644 sonar-project.properties delete mode 100644 team.go create mode 100644 ui/ui.go diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index bccc212..3340353 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -29,9 +29,3 @@ jobs: - name: Test run: | make test - - - name: SonarCloud Scan - uses: sonarsource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.gitignore b/.gitignore index cd29a58..725b1c9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,3 @@ trace.out debug.test vendor/ debug - -# Sonar -.scannerwork/ diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..20f7672 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,9 @@ +# Changelog + +## next + +- Convert to [Cobra](https://github.com/spf13/cobra). + +## 1.0.0 + +- Original CLI app, written with [urfave/cli](https://github.com/urfave/cli) diff --git a/README.md b/README.md index d59d6de..1c742cb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Donny -[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=donny&metric=alert_status)](https://sonarcloud.io/dashboard?id=donny) +![Go](https://github.com/benmatselby/donny/workflows/Go/badge.svg) [![Go Report Card](https://goreportcard.com/badge/github.com/benmatselby/donny?style=flat-square)](https://goreportcard.com/report/github.com/benmatselby/donny) _Forget it, Donny, you're out of your element!_ @@ -8,30 +8,36 @@ _Forget it, Donny, you're out of your element!_ CLI application for getting information out of Azure DevOps. It's based on [Trello CLI](https://github.com/benmatselby/trello-cli) so the aims are the same: ```shell -COMMANDS: - help, h Shows a list of commands or help for one command - build: - build:list, bl List all the builds - build:overview, bo Show build overview for build definitions in a given path - code: - code:branches, cb Show branch information for a repo - iteration: - iteration:burndown, ib Show column based data for the iteration - iteration:items, ii List all the work items in a given iteration - iteration:list, il List all the iterations - iteration:people, ip Show people based data for the iteration - plans: - plan:list, pll List all the delivery plans - plan:timeline, plt Show the timeline for the delivery plan - pull requests: - pr:list, pul List all the pull requests +CLI application for retrieving data from Azure DevOps + +Usage: + donny [command] + +Available Commands: + branch Provide a list of pull requests + builds Provide a list of builds + help Help about any command + iteration-burndown Provide a burndown of the iterations + iteration-items Provide a list of items in an iterations + iteration-people Provide a person breakdown for the iteration + iterations Provide a list of iterations + plan Get information about a delivery plan + plans Provide a list of delivery plans + prs Provide a list of pull requests + teams Provide a list of teams (Defaults to teams you are in) + +Flags: + --config string config file (default is $HOME/.benmatselby/donny.yaml) + -h, --help help for donny + +Use "donny [command] --help" for more information about a command. ``` ## Requirements If you are wanting to build and develop this, you will need the following items installed. If, however, you just want to run the application I recommend using the docker container (See below) -- Go version 1.12+ +- Go version 1.16+ ## Configuration @@ -65,7 +71,7 @@ $ docker run \ git clone git@github.com:benmatselby/donny.git cd donny make all -./donny iteration:list +./donny builds ``` You can also install into your `$GOPATH/bin` by `go install` diff --git a/build.go b/build.go deleted file mode 100644 index aaceddf..0000000 --- a/build.go +++ /dev/null @@ -1,132 +0,0 @@ -package main - -import ( - "fmt" - "os" - "regexp" - "sort" - "strconv" - "strings" - "sync" - "text/tabwriter" - "time" - - "github.com/benmatselby/go-azuredevops/azuredevops" - "github.com/urfave/cli" -) - -// ListBuilds will call the API and get a list of builds -func ListBuilds(c *cli.Context) { - count := c.Int("count") - filterBranch := c.String("branch") - - options := &azuredevops.BuildsListOptions{ - Count: count, - } - builds, err := client.Builds.List(options) - if err != nil { - fmt.Fprintf(os.Stderr, "unable to get a list of builds: %v", err) - os.Exit(2) - } - - if len(builds) == 0 { - return - } - - renderBuilds(builds, len(builds), filterBranch) -} - -// ListBuildOverview will call the API and get a list of builds for a given path -func ListBuildOverview(c *cli.Context) { - filterBranch := c.String("branch") - path := c.String("path") - - buildDefOpts := azuredevops.BuildDefinitionsListOptions{Path: "\\" + path} - definitions, err := client.BuildDefinitions.List(&buildDefOpts) - if err != nil { - fmt.Fprintf(os.Stderr, "unable to get a list of build definitions: %v", err) - os.Exit(2) - } - - results := make(chan azuredevops.Build) - var wg sync.WaitGroup - wg.Add(len(definitions)) - - go func() { - wg.Wait() - close(results) - }() - - for _, definition := range definitions { - go func(definition azuredevops.BuildDefinition) { - defer wg.Done() - - for _, branchName := range strings.Split(filterBranch, ",") { - builds, err := getBuildsForBranch(definition.ID, branchName) - if err != nil { - fmt.Printf("unable to get builds for definition %s: %v", definition.Name, err) - } - if len(builds) > 0 { - results <- builds[0] - } - } - }(definition) - } - - var builds []azuredevops.Build - for result := range results { - builds = append(builds, result) - } - - sort.Slice(builds, func(i, j int) bool { return builds[i].Definition.Name < builds[j].Definition.Name }) - - renderBuilds(builds, len(builds), ".*") -} - -func getBuildsForBranch(defID int, branchName string) ([]azuredevops.Build, error) { - buildOpts := azuredevops.BuildsListOptions{Definitions: strconv.Itoa(defID), Branch: "refs/heads/" + branchName, Count: 1} - build, err := client.Builds.List(&buildOpts) - return build, err -} - -func renderBuilds(builds []azuredevops.Build, count int, filterBranch string) { - w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', tabwriter.FilterHTML) - fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", "", "Name", "Branch", "Build", "Finished") - for index := 0; index < count; index++ { - build := builds[index] - name := build.Definition.Name - result := build.Result - status := build.Status - buildNo := build.BuildNumber - branch := build.Branch - - // Deal with date formatting for the finish time - finish, err := time.Parse(time.RFC3339, builds[index].FinishTime) - finishAt := finish.Format(appDateTimeFormat) - if err != nil { - finishAt = builds[index].FinishTime - } - - // Filter on branches - matched, _ := regexp.MatchString(".*"+filterBranch+".*", branch) - if matched == false { - continue - } - - if status == "inProgress" { - result = appProgress - } else if status == "notStarted" { - result = appPending - } else { - if result == "failed" { - result = appFailure - } else { - result = appSuccess - } - } - - fmt.Fprintf(w, "%s \t%s\t%s\t%s\t%s\n", result, name, branch, buildNo, finishAt) - } - - w.Flush() -} diff --git a/cmd/build.go b/cmd/build.go new file mode 100644 index 0000000..7fb4d34 --- /dev/null +++ b/cmd/build.go @@ -0,0 +1,97 @@ +package cmd + +import ( + "fmt" + "os" + "regexp" + "text/tabwriter" + "time" + + "github.com/benmatselby/donny/ui" + "github.com/benmatselby/go-azuredevops/azuredevops" + "github.com/spf13/cobra" +) + +// ListBuildsOptions defines what arguments/options the user can provide for the +// command. +type ListBuildsOptions struct { + Args []string + Repo string + Branch string + Count int +} + +func NewListBuildsCommand(client *azuredevops.Client) *cobra.Command { + var opts ListBuildsOptions + cmd := &cobra.Command{ + Use: "builds", + Short: "Provide a list of builds", + RunE: func(cmd *cobra.Command, args []string) error { + opts.Args = args + + options := &azuredevops.BuildsListOptions{ + Count: opts.Count, + } + + builds, err := client.Builds.List(options) + if err != nil { + return fmt.Errorf("unable to get a list of builds: %v", err) + } + + if len(builds) > 0 { + renderBuilds(builds, len(builds), opts.Branch) + } + + return nil + }, + } + + flags := cmd.Flags() + flags.StringVar(&opts.Repo, "repo", "", "The repo to filter on") + flags.IntVar(&opts.Count, "count", 10, "How many builds to show") + flags.StringVar(&opts.Branch, "branch", "", "The branch to filter on") + + return cmd +} + +func renderBuilds(builds []azuredevops.Build, count int, filterBranch string) { + w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', tabwriter.FilterHTML) + fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", "", "Name", "Branch", "Build", "Finished") + for index := 0; index < count; index++ { + build := builds[index] + name := build.Definition.Name + result := build.Result + status := build.Status + buildNo := build.BuildNumber + branch := build.Branch + + // Deal with date formatting for the finish time + finish, err := time.Parse(time.RFC3339, builds[index].FinishTime) + finishAt := finish.Format(ui.AppDateTimeFormat) + if err != nil { + finishAt = builds[index].FinishTime + } + + // Filter on branches + matched, _ := regexp.MatchString(".*"+filterBranch+".*", branch) + if !matched { + continue + } + + if status == "inProgress" { + result = ui.AppProgress + } else if status == "notStarted" { + result = ui.AppPending + } else { + if result == "failed" { + result = ui.AppFailure + } else { + result = ui.AppSuccess + } + } + + fmt.Fprintf(w, "%s \t%s\t%s\t%s\t%s\n", result, name, branch, buildNo, finishAt) + } + + w.Flush() +} diff --git a/cmd/code.go b/cmd/code.go new file mode 100644 index 0000000..97c496e --- /dev/null +++ b/cmd/code.go @@ -0,0 +1,69 @@ +package cmd + +import ( + "fmt" + "os" + "text/tabwriter" + + "github.com/benmatselby/donny/ui" + "github.com/benmatselby/go-azuredevops/azuredevops" + "github.com/spf13/cobra" +) + +// ListBranchInfoOptions defines what arguments/options the user can provide for the +// command. +type ListBranchInfoOptions struct { + Args []string + Repo string +} + +func NewListBranchInfoCommand(client *azuredevops.Client) *cobra.Command { + var opts ListBranchInfoOptions + cmd := &cobra.Command{ + Use: "branch", + Short: "Provide a list of pull requests", + RunE: func(cmd *cobra.Command, args []string) error { + opts.Args = args + + if opts.Repo == "" { + return fmt.Errorf("expected argument of repo") + } + gitRefOps := azuredevops.GitRefListOptions{ + IncludeStatuses: true, + LatestStatusesOnly: true, + } + refs, _, err := client.Git.ListRefs(opts.Repo, "heads", &gitRefOps) + if err != nil { + return fmt.Errorf("unable to get git refs for %s: %+v", opts.Repo, err) + } + + w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', tabwriter.FilterHTML) + + for _, ref := range refs { + state := ui.AppUnknown + if len(ref.Statuses) > 0 { + state = ref.Statuses[0].State + + if state == "failed" { + state = ui.AppFailure + } else if state == "pending" { + state = ui.AppPending + } else { + state = ui.AppSuccess + } + } + + fmt.Fprintf(w, "%s \t%s\n", state, ref.Name) + } + + w.Flush() + + return nil + }, + } + + flags := cmd.Flags() + flags.StringVar(&opts.Repo, "repo", "", "The repo to filter on") + + return cmd +} diff --git a/cmd/delivery_plan.go b/cmd/delivery_plan.go new file mode 100644 index 0000000..c581747 --- /dev/null +++ b/cmd/delivery_plan.go @@ -0,0 +1,137 @@ +package cmd + +import ( + "fmt" + "os" + "strings" + "text/tabwriter" + "time" + + "github.com/benmatselby/donny/ui" + "github.com/benmatselby/go-azuredevops/azuredevops" + "github.com/spf13/cobra" +) + +func NewListDeliveryPlansCommand(client *azuredevops.Client) *cobra.Command { + cmd := &cobra.Command{ + Use: "plans", + Short: "Provide a list of delivery plans", + RunE: func(cmd *cobra.Command, args []string) error { + options := &azuredevops.DeliveryPlansListOptions{} + plans, _, err := client.DeliveryPlans.List(options) + if err != nil { + return fmt.Errorf("unable to get a list of delivery plans: %v", err) + } + + w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', tabwriter.FilterHTML) + fmt.Fprintf(w, "%s\t%s\n", "Name", "Created") + + for _, plan := range plans { + // Deal with date formatting for the finish time + created, err := time.Parse(time.RFC3339, plan.Created) + createdOn := created.Format(ui.AppDateFormat) + if err != nil { + createdOn = plan.Created + } + + fmt.Fprintf(w, "%s\t%s\n", plan.Name, createdOn) + } + w.Flush() + return nil + }, + } + + return cmd +} + +// GetDeliveryPlanOptions defines what arguments/options the user can provide for +// the `repos` command. +type GetDeliveryPlanOptions struct { + Args []string + Plan string + ShowTags bool +} + +func NewGetDeliveryPlanCommand(client *azuredevops.Client) *cobra.Command { + var opts GetDeliveryPlanOptions + + cmd := &cobra.Command{ + Use: "plan", + Short: "Get information about a delivery plan", + RunE: func(cmd *cobra.Command, args []string) error { + if opts.Plan == "" { + return fmt.Errorf("please provide a delivery plan") + } + + options := &azuredevops.DeliveryPlansListOptions{} + plans, _, err := client.DeliveryPlans.List(options) + if err != nil { + return fmt.Errorf("unable to get a list of delivery plans: %v", err) + } + + for _, plan := range plans { + if plan.Name == opts.Plan { + timeline, err := client.DeliveryPlans.GetTimeLine(plan.ID, "", "") + if err != nil { + return fmt.Errorf("unable to get the delivery plan timeline time for %s: %v", plan.ID, err) + } + + start, _ := time.Parse(time.RFC3339, timeline.StartDate) + end, _ := time.Parse(time.RFC3339, timeline.EndDate) + fmt.Printf("Name: %s\n", plan.Name) + fmt.Printf("Start: %s\n", start.Format(ui.AppDateFormat)) + fmt.Printf("End: %s\n", end.Format(ui.AppDateFormat)) + fmt.Printf("Revision: %d\n\n", timeline.Revision) + + for _, team := range timeline.Teams { + fmt.Println(team.Name) + fmt.Println(strings.Repeat("=", len(team.Name))) + fmt.Println() + + for _, iteration := range team.Iterations { + iStart, _ := time.Parse(time.RFC3339, iteration.StartDate) + iEnd, _ := time.Parse(time.RFC3339, iteration.EndDate) + title := fmt.Sprintf( + "%s (%s - %s)", + iteration.Name, + iStart.Format(ui.AppDateFormat), + iEnd.Format(ui.AppDateFormat), + ) + + fmt.Println(title) + fmt.Println(strings.Repeat("-", len(title))) + fmt.Println() + + for _, item := range iteration.WorkItems { + line := fmt.Sprintf( + "* %v - %s", + item[azuredevops.DeliveryPlanWorkItemIDKey], + item[azuredevops.DeliveryPlanWorkItemNameKey], + ) + + if opts.ShowTags { + line += fmt.Sprintf(" (%s)", item[azuredevops.DeliveryPlanWorkItemTagKey]) + } + + fmt.Println(line) + } + + fmt.Println() + fmt.Println() + } + + fmt.Println() + } + break + } + } + return nil + }, + } + + flags := cmd.Flags() + flags.StringVar(&opts.Plan, "plan", "", "The delivery plan to show") + flags.BoolVar(&opts.ShowTags, "show-tags", false, "Should tags be displayed") + + return cmd +} diff --git a/cmd/iteration.go b/cmd/iteration.go new file mode 100644 index 0000000..dcd6650 --- /dev/null +++ b/cmd/iteration.go @@ -0,0 +1,316 @@ +package cmd + +import ( + "fmt" + "os" + "strings" + "text/tabwriter" + + "github.com/benmatselby/go-azuredevops/azuredevops" + "github.com/spf13/cobra" +) + +// ListIterationsOptions defines what arguments/options the user can provide for the +// command. +type ListIterationsOptions struct { + Args []string + Team string +} + +func NewListIterationsCommand(client *azuredevops.Client) *cobra.Command { + var opts ListIterationsOptions + cmd := &cobra.Command{ + Use: "iterations", + Short: "Provide a list of iterations", + RunE: func(cmd *cobra.Command, args []string) error { + opts.Args = args + + iterations, err := client.Iterations.List(opts.Team) + if err != nil { + fmt.Fprintf(os.Stderr, "could not list iterations: %v", err) + os.Exit(2) + } + + for index := 0; index < len(iterations); index++ { + fmt.Println(iterations[index].Name) + } + + return nil + }, + } + + flags := cmd.Flags() + flags.StringVar(&opts.Team, "team", "", "The team to get iterations for") + + return cmd +} + +// ListItemsInIterationOptions defines what arguments/options the user can provide for the +// command. +type ListItemsInIterationOptions struct { + Args []string + Team string + Iteration string + Board string + HideTag string + ShowTag string +} + +// NewListItemsInIteration will call the API and get a list of items for an iteration +func NewListItemsInIteration(client *azuredevops.Client) *cobra.Command { + var opts ListItemsInIterationOptions + cmd := &cobra.Command{ + Use: "iteration-items", + Short: "Provide a list of items in an iterations", + RunE: func(cmd *cobra.Command, args []string) error { + opts.Args = args + + items, err := getWorkItems(client, opts.Team, opts.Iteration) + if err != nil { + return err + } + + workItems := getWorkItemsByBoardColumn(items) + + // Get the board layout so we now how to render the columns in the right order + boards, err := client.Boards.List(opts.Team) + if err != nil { + return fmt.Errorf("could not list the boards: %v", err) + } + + // We need to get the specific board we are interested in + for _, board := range boards { + if board.Name == opts.Board { + b, err := client.Boards.Get(opts.Team, board.ID) + if err != nil { + return fmt.Errorf("could not get board: %v", err) + } + + // Now we want a string we can display + asList := "" + for _, column := range b.Columns { + asList += "\n" + column.Name + "\n" + asList += strings.Repeat("=", len(column.Name)) + "\n" + for _, item := range workItems[column.Name] { + if opts.HideTag != "" && stringInSlice(opts.HideTag, item.Fields.TagList) { + continue + } + + if opts.ShowTag != "" && !stringInSlice(opts.ShowTag, item.Fields.TagList) { + continue + } + asList += fmt.Sprintf("* (%g) %s\n", item.Fields.Points, item.Fields.Title) + } + } + fmt.Println(asList) + + break + } + } + + return nil + }, + } + + flags := cmd.Flags() + flags.StringVar(&opts.Team, "team", "", "The team the iteration belongs to") + flags.StringVar(&opts.Iteration, "iteration", "", "The iteration name") + flags.StringVar(&opts.Board, "board", "Stories", "The board name") + flags.StringVar(&opts.HideTag, "hide-tags", "", "Items to hide based on tags") + flags.StringVar(&opts.ShowTag, "show-tags", "", "Items to show based on tags") + + return cmd +} + +// NewIterationBurndownCommand will display column based data that helps with a daily burndown +func NewIterationBurndownCommand(client *azuredevops.Client) *cobra.Command { + var opts ListItemsInIterationOptions + cmd := &cobra.Command{ + Use: "iteration-burndown", + Short: "Provide a burndown of the iterations", + RunE: func(cmd *cobra.Command, args []string) error { + opts.Args = args + + items, err := getWorkItems(client, opts.Team, opts.Iteration) + if err != nil { + return err + } + + workItems := getWorkItemsByBoardColumn(items) + + // Get the board layout so we now how to render the columns in the right order + boards, err := client.Boards.List(opts.Team) + if err != nil { + return fmt.Errorf("could not list boards: %v", err) + } + + // We need to get the specific board we are interested in + for _, board := range boards { + if board.Name == opts.Board { + b, err := client.Boards.Get(opts.Team, board.ID) + if err != nil { + return fmt.Errorf("could not get board: %v", err) + } + + // Now we want a string we can display + w := tabwriter.NewWriter(os.Stdout, 0, 1, 1, ' ', 0) + fmt.Fprintf(w, "%s\t%s\t%s\n", "Column", "Items", "Points") + fmt.Fprintf(w, "%s\t%s\t%s\n", "------", "-----", "------") + totalItems := 0 + totalPoints := 0.0 + for _, column := range b.Columns { + points := 0.0 + itemCount := len(workItems[column.Name]) + + for _, item := range workItems[column.Name] { + points += item.Fields.Points + } + totalPoints += points + totalItems += itemCount + + fmt.Fprintf(w, "%s\t%d\t%g\n", column.Name, itemCount, points) + } + + fmt.Fprintf(w, "%s\t%s\t%s\n", "------", "", "") + fmt.Fprintf(w, "%s\t%d\t%g\n", "Total", totalItems, totalPoints) + fmt.Fprintf(w, "%s\t%s\t%s\n", "------", "", "") + + w.Flush() + + break + } + } + return nil + }, + } + + flags := cmd.Flags() + flags.StringVar(&opts.Team, "team", "", "The team the iteration belongs to") + flags.StringVar(&opts.Iteration, "iteration", "", "The iteration name") + flags.StringVar(&opts.Board, "board", "Stories", "The board name") + flags.StringVar(&opts.HideTag, "hide-tags", "", "Items to hide based on tags") + flags.StringVar(&opts.ShowTag, "show-tags", "", "Items to show based on tags") + + return cmd +} + +// NewIterationPeopleBreakdownCommand will display column based data that show person breakdown +func NewIterationPeopleBreakdownCommand(client *azuredevops.Client) *cobra.Command { + var opts ListItemsInIterationOptions + cmd := &cobra.Command{ + Use: "iteration-people", + Short: "Provide a person breakdown for the iteration", + RunE: func(cmd *cobra.Command, args []string) error { + opts.Args = args + + items, err := getWorkItems(client, opts.Team, opts.Iteration) + if err != nil { + fmt.Fprint(os.Stderr, err) + os.Exit(2) + } + + workItems := getWorkItemsByPerson(items) + + w := tabwriter.NewWriter(os.Stdout, 0, 1, 1, ' ', 0) + fmt.Fprintf(w, "%s\t%s\t%s\n", "Person", "Items", "Points") + fmt.Fprintf(w, "%s\t%s\t%s\n", "------", "-----", "------") + totalItems := 0 + totalPoints := 0.0 + for person, items := range workItems { + points := 0.0 + itemCount := len(items) + + if person == "" { + person = "Unassigned" + } + + // Cut the email address out + person = strings.Split(person, "<")[0] + + for _, item := range items { + points += item.Fields.Points + } + totalPoints += points + totalItems += itemCount + + fmt.Fprintf(w, "%s\t%d\t%g\n", person, itemCount, points) + } + fmt.Fprintf(w, "%s\t%s\t%s\n", "------", "", "") + fmt.Fprintf(w, "%s\t%d\t%g\n", "Total", totalItems, totalPoints) + fmt.Fprintf(w, "%s\t%s\t%s\n", "------", "", "") + w.Flush() + + return nil + }, + } + + flags := cmd.Flags() + flags.StringVar(&opts.Team, "team", "", "The team the iteration belongs to") + flags.StringVar(&opts.Iteration, "iteration", "", "The iteration name") + flags.StringVar(&opts.Board, "board", "Stories", "The board name") + flags.StringVar(&opts.HideTag, "hide-tags", "", "Items to hide based on tags") + flags.StringVar(&opts.ShowTag, "show-tags", "", "Items to show based on tags") + + return cmd +} + +// getWorkItemsByPerson will return the work items grouped by person +func getWorkItemsByPerson(workItems []azuredevops.WorkItem) map[string][]azuredevops.WorkItem { + items := make(map[string][]azuredevops.WorkItem) + + // Now build a map|slice|array (!) of + // Person => Items[] + for index := 0; index < len(workItems); index++ { + item := workItems[index] + key := item.Fields.AssignedTo + items[key.DisplayName] = append(items[key.DisplayName], item) + } + + return items +} + +func getWorkItemsByBoardColumn(workItems []azuredevops.WorkItem) map[string][]azuredevops.WorkItem { + items := make(map[string][]azuredevops.WorkItem) + + // Now build a map|slice|array (!) of + // BoardColumn => Items[] + for index := 0; index < len(workItems); index++ { + item := workItems[index] + + if item.Fields.Type == "Task" { + continue + } + key := item.Fields.BoardColumn + items[key] = append(items[key], item) + } + + return items +} + +func getWorkItems(client *azuredevops.Client, team string, iterationName string) ([]azuredevops.WorkItem, error) { + iteration, err := client.Iterations.GetByName(team, iterationName) + if err != nil { + return nil, fmt.Errorf("could not get work items for %s: %v", iterationName, err) + } + + if iteration == nil { + return nil, fmt.Errorf("unable to find iteration: %s", iterationName) + } + + // Get the items for the iteration we have found + workItems, err := client.WorkItems.GetForIteration(team, *iteration) + if err != nil { + return nil, err + } + + return workItems, nil +} + +func stringInSlice(str string, list []string) bool { + for _, v := range list { + if v == str { + return true + } + } + return false +} diff --git a/cmd/pull_request.go b/cmd/pull_request.go new file mode 100644 index 0000000..c7e4d04 --- /dev/null +++ b/cmd/pull_request.go @@ -0,0 +1,91 @@ +package cmd + +import ( + "fmt" + "os" + "regexp" + "text/tabwriter" + "time" + + "github.com/benmatselby/donny/ui" + "github.com/benmatselby/go-azuredevops/azuredevops" + "github.com/spf13/cobra" +) + +// ListPullRequestsOptions defines what arguments/options the user can provide for the +// command. +type ListPullRequestsOptions struct { + Args []string + Count int + Repo string + State string +} + +func NewListPullRequestsCommand(client *azuredevops.Client) *cobra.Command { + var opts ListPullRequestsOptions + cmd := &cobra.Command{ + Use: "prs", + Short: "Provide a list of pull requests", + RunE: func(cmd *cobra.Command, args []string) error { + opts.Args = args + + options := &azuredevops.PullRequestListOptions{State: opts.State} + pulls, _, err := client.PullRequests.List(options) + if err != nil { + fmt.Fprintf(os.Stderr, "could not get list of pull requests: %v", err) + os.Exit(2) + } + + if len(pulls) < opts.Count { + opts.Count = len(pulls) + } + + w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', tabwriter.FilterHTML) + fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", "", "ID", "Title", "Repo", "Created") + + for index := 0; index < opts.Count; index++ { + pull := pulls[index] + + repoName := pull.Repo.Name + + // Filter on branches + matched, _ := regexp.MatchString(".*"+opts.Repo+".*", repoName) + if !matched { + continue + } + + title := pull.Title + status := pull.Status + + // Deal with date formatting + when, err := time.Parse(time.RFC3339, pull.Created) + created := when.Format(ui.AppDateTimeFormat) + if err != nil { + created = pull.Created + } + + var result string + if status == "completed" { + result = ui.AppSuccess + } else if status == "abandoned" { + result = ui.AppStale + } else { + result = ui.AppPending + } + + fmt.Fprintf(w, "%s \t%d\t%s\t%s\t%s\n", result, pull.ID, title, repoName, created) + } + + w.Flush() + + return nil + }, + } + + flags := cmd.Flags() + flags.StringVar(&opts.Repo, "repo", "", "The repo to filter on") + flags.IntVar(&opts.Count, "count", 10, "Number of pull requests to show") + flags.StringVar(&opts.State, "state", "active", "The state of the pull requests we want to filter on") + + return cmd +} diff --git a/cmd/root.go b/cmd/root.go new file mode 100644 index 0000000..8b455c3 --- /dev/null +++ b/cmd/root.go @@ -0,0 +1,90 @@ +package cmd + +import ( + "fmt" + "os" + "strings" + + "github.com/benmatselby/donny/version" + "github.com/benmatselby/go-azuredevops/azuredevops" + homedir "github.com/mitchellh/go-homedir" + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +var cfgFile string + +// Execute adds all child commands to the root command and sets flags appropriately. +// This is called by main.main(). It only needs to happen once to the rootCmd. +func Execute() { + initConfig() + + cmd := NewRootCommand() + + if err := cmd.Execute(); err != nil { + fmt.Println(err) + os.Exit(1) + } +} + +// NewRootCommand will return the application +func NewRootCommand() *cobra.Command { + var cmd = &cobra.Command{ + Use: "donny", + Short: "CLI application for retrieving data from Azure DevOps", + Version: version.GITCOMMIT, + } + + // Here you will define your flags and configuration settings. + // Cobra supports persistent flags, which, if defined here, + // will be global for your application. + cmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.benmatselby/donny.yaml)") + + client := azuredevops.NewClient( + viper.GetString("AZURE_DEVOPS_ACCOUNT"), + viper.GetString("AZURE_DEVOPS_PROJECT"), + viper.GetString("AZURE_DEVOPS_TOKEN"), + ) + client.UserAgent = "donny/go-azuredevops" + + cmd.AddCommand( + NewListTeamsCommand(client), + NewListPullRequestsCommand(client), + NewListBranchInfoCommand(client), + NewListBuildsCommand(client), + NewListDeliveryPlansCommand(client), + NewGetDeliveryPlanCommand(client), + NewListIterationsCommand(client), + NewListItemsInIteration(client), + NewIterationBurndownCommand(client), + NewIterationPeopleBreakdownCommand(client), + ) + return cmd +} + +// initConfig reads in config file and ENV variables if set. +func initConfig() { + if cfgFile != "" { + // Use config file from the flag. + viper.SetConfigFile(cfgFile) + } else { + // Find home directory. + home, err := homedir.Dir() + if err != nil { + fmt.Println(err) + os.Exit(1) + } + + path := strings.Join([]string{home, ".benmatselby"}, "/") + viper.AddConfigPath(path) + viper.SetConfigName("donny") + } + + viper.AutomaticEnv() // read in environment variables that match + + // If a config file is found, read it in. + err := viper.ReadInConfig() + if fmt.Sprintf("%T", err) == "ConfigParseError" { + fmt.Fprintf(os.Stderr, "Failed to load config: %s\n", err) + } +} diff --git a/cmd/team.go b/cmd/team.go new file mode 100644 index 0000000..63fbc39 --- /dev/null +++ b/cmd/team.go @@ -0,0 +1,57 @@ +package cmd + +import ( + "fmt" + "os" + "sort" + "text/tabwriter" + + "github.com/benmatselby/go-azuredevops/azuredevops" + "github.com/spf13/cobra" +) + +// ListTeamsOptions defines what arguments/options the user can provide for the +// command. +type ListTeamsOptions struct { + Args []string + Mine bool +} + +func NewListTeamsCommand(client *azuredevops.Client) *cobra.Command { + var opts ListTeamsOptions + cmd := &cobra.Command{ + Use: "teams", + Short: "Provide a list of teams (Defaults to teams you are in)", + RunE: func(cmd *cobra.Command, args []string) error { + opts.Args = args + + apiOpts := azuredevops.TeamsListOptions{} + + if opts.Mine { + apiOpts.Mine = opts.Mine + } + teams, _, err := client.Teams.List(&apiOpts) + if err != nil { + return fmt.Errorf("unable to get teams: %+v", err) + } + + sort.Slice(teams, func(i, j int) bool { + return teams[i].Name < teams[j].Name + }) + + w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', tabwriter.FilterHTML) + + for _, team := range teams { + fmt.Fprintf(w, "%s\n", team.Name) + } + + w.Flush() + return nil + }, + } + + flags := cmd.Flags() + flags.BoolVar(&opts.Mine, "mine", false, "List only my teams") + + return cmd +} diff --git a/code.go b/code.go deleted file mode 100644 index 77847a4..0000000 --- a/code.go +++ /dev/null @@ -1,51 +0,0 @@ -package main - -import ( - "fmt" - "os" - "text/tabwriter" - - "github.com/benmatselby/go-azuredevops/azuredevops" - "github.com/urfave/cli" -) - -// ShowGitBranchInfo will get branch information for a repo -func ShowGitBranchInfo(c *cli.Context) { - if len(c.Args()) < 1 { - cli.ShowSubcommandHelp(c) - os.Exit(2) - } - - repo := c.Args()[0] - - gitRefOps := azuredevops.GitRefListOptions{ - IncludeStatuses: true, - LatestStatusesOnly: true, - } - refs, _, err := client.Git.ListRefs(repo, "heads", &gitRefOps) - if err != nil { - fmt.Fprintf(os.Stderr, "unable to get git refs for %s: %+v", repo, err) - os.Exit(2) - } - - w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', tabwriter.FilterHTML) - - for _, ref := range refs { - state := appUnknown - if len(ref.Statuses) > 0 { - state = ref.Statuses[0].State - - if state == "failed" { - state = appFailure - } else if state == "pending" { - state = appPending - } else { - state = appSuccess - } - } - - fmt.Fprintf(w, "%s \t%s\n", state, ref.Name) - } - - w.Flush() -} diff --git a/delivery_plan.go b/delivery_plan.go deleted file mode 100644 index 96f6e1b..0000000 --- a/delivery_plan.go +++ /dev/null @@ -1,120 +0,0 @@ -package main - -import ( - "fmt" - "os" - "strings" - "text/tabwriter" - "time" - - "github.com/benmatselby/go-azuredevops/azuredevops" - "github.com/urfave/cli" -) - -// ListDeliveryPlans will call the API and get a list of delivery plans -func ListDeliveryPlans(c *cli.Context) { - options := &azuredevops.DeliveryPlansListOptions{} - plans, _, err := client.DeliveryPlans.List(options) - if err != nil { - fmt.Fprintf(os.Stderr, "unable to get a list of delivery plans: %v", err) - os.Exit(2) - } - - if len(plans) == 0 { - return - } - - w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', tabwriter.FilterHTML) - fmt.Fprintf(w, "%s\t%s\n", "Name", "Created") - - for _, plan := range plans { - // Deal with date formatting for the finish time - created, err := time.Parse(time.RFC3339, plan.Created) - createdOn := created.Format(appDateFormat) - if err != nil { - createdOn = plan.Created - } - - fmt.Fprintf(w, "%s\t%s\n", plan.Name, createdOn) - } - w.Flush() -} - -// GetDeliveryPlanTimeLine will call the API and get a list of delivery plans -func GetDeliveryPlanTimeLine(c *cli.Context) { - if len(c.Args()) < 1 { - cli.ShowSubcommandHelp(c) - os.Exit(2) - } - planName := c.Args()[0] - showTag := c.Bool("show-tags") - - options := &azuredevops.DeliveryPlansListOptions{} - plans, _, err := client.DeliveryPlans.List(options) - if err != nil { - fmt.Fprintf(os.Stderr, "unable to get a list of delivery plans: %v", err) - os.Exit(2) - } - - if len(plans) == 0 { - return - } - - for _, plan := range plans { - if plan.Name == planName { - timeline, err := client.DeliveryPlans.GetTimeLine(plan.ID, "", "") - if err != nil { - fmt.Fprintf(os.Stderr, "unable to get the delivery plan timeline time for %s: %v", plan.ID, err) - return - } - - start, _ := time.Parse(time.RFC3339, timeline.StartDate) - end, _ := time.Parse(time.RFC3339, timeline.EndDate) - fmt.Printf("Name: %s\n", plan.Name) - fmt.Printf("Start: %s\n", start.Format(appDateFormat)) - fmt.Printf("End: %s\n", end.Format(appDateFormat)) - fmt.Printf("Revision: %d\n\n", timeline.Revision) - - for _, team := range timeline.Teams { - fmt.Println(team.Name) - fmt.Println(strings.Repeat("=", len(team.Name))) - fmt.Println() - - for _, iteration := range team.Iterations { - iStart, _ := time.Parse(time.RFC3339, iteration.StartDate) - iEnd, _ := time.Parse(time.RFC3339, iteration.EndDate) - title := fmt.Sprintf( - "%s (%s - %s)", - iteration.Name, - iStart.Format(appDateFormat), - iEnd.Format(appDateFormat), - ) - - fmt.Println(title) - fmt.Println(strings.Repeat("-", len(title))) - fmt.Println() - - for _, item := range iteration.WorkItems { - line := fmt.Sprintf( - "* %v - %s", - item[azuredevops.DeliveryPlanWorkItemIDKey], - item[azuredevops.DeliveryPlanWorkItemNameKey], - ) - - if showTag { - line += fmt.Sprintf(" (%s)", item[azuredevops.DeliveryPlanWorkItemTagKey]) - } - - fmt.Println(line) - } - - fmt.Println() - fmt.Println() - } - - fmt.Println() - } - return - } - } -} diff --git a/go.mod b/go.mod index 9078dad..0c3b1d0 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,9 @@ module github.com/benmatselby/donny go 1.16 require ( - github.com/benmatselby/go-azuredevops v0.0.0-20190112144040-c2a0219308ca - github.com/google/go-querystring v1.0.0 // indirect - github.com/urfave/cli v1.20.0 + github.com/benmatselby/go-azuredevops v0.4.0 + github.com/google/go-querystring v1.1.0 // indirect + github.com/mitchellh/go-homedir v1.1.0 + github.com/spf13/cobra v1.1.3 + github.com/spf13/viper v1.7.1 ) diff --git a/go.sum b/go.sum index 7fa0e39..25edbb0 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,321 @@ -github.com/benmatselby/go-azuredevops v0.0.0-20190112144040-c2a0219308ca h1:GDsxjooiPXexocQ9an2z85qnF2RCMN8DzFv4HETIxgQ= -github.com/benmatselby/go-azuredevops v0.0.0-20190112144040-c2a0219308ca/go.mod h1:1iGYUo0OwirKk+wm+lftDoaTtOgRYRuIZ81Fq1IJZTw= -github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/benmatselby/go-azuredevops v0.4.0 h1:mhPrhleksYy4DNOKVp0Y0Ep7uPoB6VRCj/kQC5v5tSE= +github.com/benmatselby/go-azuredevops v0.4.0/go.mod h1:dpdX5eGpPCG/+9QpBBLEnb8sjPsjPY8yAOTtmo/faig= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= -github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw= -github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= +github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M= +github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= +github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.7.1 h1:pM5oEahlgWv/WnHXpgbKz7iLIxRf65tye2Ci+XFK5sk= +github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0 h1:HyfiK1WMnHj5FXFXatD+Qs1A/xC2Run6RzeW1SyHxpc= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/iteration.go b/iteration.go deleted file mode 100644 index 74bc63d..0000000 --- a/iteration.go +++ /dev/null @@ -1,247 +0,0 @@ -package main - -import ( - "fmt" - "os" - "strings" - "text/tabwriter" - - "github.com/benmatselby/go-azuredevops/azuredevops" - "github.com/urfave/cli" -) - -// ListIterations will call the API and get a list of iterations -func ListIterations(c *cli.Context) { - iterations, err := client.Iterations.List(team) - if err != nil { - fmt.Fprintf(os.Stderr, "could not list iterations: %v", err) - os.Exit(2) - } - - for index := 0; index < len(iterations); index++ { - fmt.Println(iterations[index].Name) - } -} - -// ListItemsInIteration will call the API and get a list of items for an iteration -func ListItemsInIteration(c *cli.Context) { - checkIterationDeclared(c) - - iterationName := c.Args()[0] - boardName := c.String("board") - hideTag := c.String("hide-tag") - showTag := c.String("filter-tag") - - items, err := getWorkItems(team, iterationName) - if err != nil { - fmt.Fprint(os.Stderr, err) - os.Exit(2) - } - - workItems := getWorkItemsByBoardColumn(items) - - // Get the board layout so we now how to render the columns in the right order - boards, err := client.Boards.List(team) - if err != nil { - fmt.Fprintf(os.Stderr, "could not list the boards: %v", err) - os.Exit(2) - } - - // We need to get the specific board we are interested in - for _, board := range boards { - if board.Name == boardName { - b, err := client.Boards.Get(team, board.ID) - if err != nil { - fmt.Fprintf(os.Stderr, "could not get board: %v", err) - os.Exit(2) - } - - // Now we want a string we can display - asList := "" - for _, column := range b.Columns { - asList += "\n" + column.Name + "\n" - asList += strings.Repeat("=", len(column.Name)) + "\n" - for _, item := range workItems[column.Name] { - if hideTag != "" && stringInSlice(hideTag, item.Fields.TagList) { - continue - } - - if showTag != "" && !stringInSlice(showTag, item.Fields.TagList) { - continue - } - asList += fmt.Sprintf("* (%g) %s\n", item.Fields.Points, item.Fields.Title) - } - } - fmt.Println(asList) - } - } -} - -// ShowIterationBurndown will display column based data that helps with a daily burndown -func ShowIterationBurndown(c *cli.Context) { - checkIterationDeclared(c) - - iterationName := c.Args()[0] - boardName := c.String("board") - - items, err := getWorkItems(team, iterationName) - if err != nil { - fmt.Fprint(os.Stderr, err) - os.Exit(2) - } - - workItems := getWorkItemsByBoardColumn(items) - - // Get the board layout so we now how to render the columns in the right order - boards, err := client.Boards.List(team) - if err != nil { - fmt.Fprintf(os.Stderr, "could not list boards: %v", err) - os.Exit(2) - } - - // We need to get the specific board we are interested in - for _, board := range boards { - if board.Name == boardName { - b, err := client.Boards.Get(team, board.ID) - if err != nil { - fmt.Fprintf(os.Stderr, "could not get board: %v", err) - os.Exit(2) - } - // Now we want a string we can display - w := tabwriter.NewWriter(os.Stdout, 0, 1, 1, ' ', 0) - fmt.Fprintf(w, "%s\t%s\t%s\n", "Column", "Items", "Points") - fmt.Fprintf(w, "%s\t%s\t%s\n", "------", "-----", "------") - totalItems := 0 - totalPoints := 0.0 - for _, column := range b.Columns { - points := 0.0 - itemCount := len(workItems[column.Name]) - - for _, item := range workItems[column.Name] { - points += item.Fields.Points - } - totalPoints += points - totalItems += itemCount - - fmt.Fprintf(w, "%s\t%d\t%g\n", column.Name, itemCount, points) - } - - fmt.Fprintf(w, "%s\t%s\t%s\n", "------", "", "") - fmt.Fprintf(w, "%s\t%d\t%g\n", "Total", totalItems, totalPoints) - fmt.Fprintf(w, "%s\t%s\t%s\n", "------", "", "") - - w.Flush() - } - } -} - -// ShowIterationPeopleBreakdown will display people based data for the iteration -func ShowIterationPeopleBreakdown(c *cli.Context) { - checkIterationDeclared(c) - - iterationName := c.Args()[0] - - items, err := getWorkItems(team, iterationName) - if err != nil { - fmt.Fprint(os.Stderr, err) - os.Exit(2) - } - - workItems := getWorkItemsByPerson(items) - - w := tabwriter.NewWriter(os.Stdout, 0, 1, 1, ' ', 0) - fmt.Fprintf(w, "%s\t%s\t%s\n", "Person", "Items", "Points") - fmt.Fprintf(w, "%s\t%s\t%s\n", "------", "-----", "------") - totalItems := 0 - totalPoints := 0.0 - for person, items := range workItems { - points := 0.0 - itemCount := len(items) - - if person == "" { - person = "Unassigned" - } - - // Cut the email address out - person = strings.Split(person, "<")[0] - - for _, item := range items { - points += item.Fields.Points - } - totalPoints += points - totalItems += itemCount - - fmt.Fprintf(w, "%s\t%d\t%g\n", person, itemCount, points) - } - fmt.Fprintf(w, "%s\t%s\t%s\n", "------", "", "") - fmt.Fprintf(w, "%s\t%d\t%g\n", "Total", totalItems, totalPoints) - fmt.Fprintf(w, "%s\t%s\t%s\n", "------", "", "") - w.Flush() -} - -func checkIterationDeclared(c *cli.Context) { - if len(c.Args()) < 1 { - cli.ShowSubcommandHelp(c) - os.Exit(2) - } -} - -func getWorkItemsByPerson(workItems []azuredevops.WorkItem) map[string][]azuredevops.WorkItem { - items := make(map[string][]azuredevops.WorkItem) - - // Now build a map|slice|array (!) of - // Person => Items[] - for index := 0; index < len(workItems); index++ { - item := workItems[index] - key := item.Fields.AssignedTo - items[key] = append(items[key], item) - } - - return items -} - -func getWorkItemsByBoardColumn(workItems []azuredevops.WorkItem) map[string][]azuredevops.WorkItem { - items := make(map[string][]azuredevops.WorkItem) - - // Now build a map|slice|array (!) of - // BoardColumn => Items[] - for index := 0; index < len(workItems); index++ { - item := workItems[index] - - if item.Fields.Type == "Task" { - continue - } - key := item.Fields.BoardColumn - items[key] = append(items[key], item) - } - - return items -} - -func getWorkItems(team string, iterationName string) ([]azuredevops.WorkItem, error) { - iteration, err := client.Iterations.GetByName(team, iterationName) - if err != nil { - return nil, fmt.Errorf("could not get work items for %s: %v", iterationName, err) - } - - if iteration == nil { - return nil, fmt.Errorf("unable to find iteration: %s", iterationName) - } - - // Get the items for the iteration we have found - workItems, err := client.WorkItems.GetForIteration(team, *iteration) - if err != nil { - return nil, err - } - - return workItems, nil -} - -func stringInSlice(str string, list []string) bool { - for _, v := range list { - if v == str { - return true - } - } - return false -} diff --git a/main.go b/main.go index 4c19f83..3a53273 100644 --- a/main.go +++ b/main.go @@ -1,193 +1,7 @@ package main -import ( - "fmt" - "os" - - "github.com/benmatselby/donny/version" - "github.com/benmatselby/go-azuredevops/azuredevops" - "github.com/urfave/cli" -) - -var ( - account string - project string - team string - token string - client *azuredevops.Client -) - -const ( - appDateFormat string = "02-01-2006" - appDateTimeFormat string = "02-01-2006 15:04" - appSuccess string = "✅" - appFailure string = "❌" - appPending string = "🗂" - appProgress string = "🏗" - appStale string = "🕳" - appUnknown string = "❓" -) - -func loadEnvironmentVars() error { - account = os.Getenv("AZURE_DEVOPS_ACCOUNT") - project = os.Getenv("AZURE_DEVOPS_PROJECT") - team = os.Getenv("AZURE_DEVOPS_TEAM") - token = os.Getenv("AZURE_DEVOPS_TOKEN") - - if account == "" || project == "" || team == "" || token == "" { - return fmt.Errorf("The environment variables are not all set") - } - - return nil -} - -func getUsage(withError bool) string { - usage := ` - _______ ______ .__ __. .__ __. ____ ____ -| \ / __ \ | \ | | | \ | | \ \ / / -| .--. | | | | | \| | | \| | \ \/ / -| | | | | | | | . | | . | \_ _/ -| '--' | --' | | |\ | | |\ | | | -|_______/ \______/ |__| \__| |__| \__| |__| - -CLI Application to get data out of Azure DevOps into the terminal, where we belong... -` - if withError { - usage = usage + ` - -In order for donny to integrate with Azure DevOps, you need to define the following environment variables: - -* AZURE_DEVOPS_ACCOUNT = %s -* AZURE_DEVOPS_PROJECT = %s -* AZURE_DEVOPS_TEAM = %s -* AZURE_DEVOPS_TOKEN = %s -` - } - - return usage -} +import "github.com/benmatselby/donny/cmd" func main() { - err := loadEnvironmentVars() - if err != nil { - fmt.Fprintln(os.Stderr, getUsage(true)) - os.Exit(2) - } - - client = azuredevops.NewClient(account, project, token) - client.UserAgent = "donny/go-azuredevops" - - app := cli.NewApp() - app.Name = "donny" - app.Author = "@benmatselby" - app.Usage = getUsage(false) - app.Version = version.GITCOMMIT - app.Commands = []cli.Command{ - { - Name: "build:list", - Usage: "List all the builds", - Action: ListBuilds, - Aliases: []string{"bl"}, - Flags: []cli.Flag{ - cli.IntFlag{Name: "count", Value: 10, Usage: "How many builds to display"}, - cli.StringFlag{Name: "branch", Value: ".*", Usage: "Filter by branch name"}, - }, - Category: "build", - }, - { - Name: "build:overview", - Usage: "Show build overview for build definitions in a given path", - Action: ListBuildOverview, - Aliases: []string{"bo"}, - Flags: []cli.Flag{ - cli.StringFlag{Name: "path", Value: os.Getenv("AZURE_DEVOPS_TEAM"), Usage: "Build definition path"}, - cli.StringFlag{Name: "branch", Value: "master", Usage: "Filter by branch name"}, - }, - Category: "build", - }, - { - Name: "code:branches", - Usage: "Show branch information for a repo", - Action: ShowGitBranchInfo, - Aliases: []string{"cb"}, - Category: "code", - }, - { - Name: "iteration:burndown", - Usage: "Show column based data for the iteration", - Action: ShowIterationBurndown, - Aliases: []string{"ib"}, - Flags: []cli.Flag{ - cli.StringFlag{Name: "board", Value: "Stories", Usage: "Display board by type"}, - }, - Category: "iteration", - }, - { - Name: "iteration:items", - Usage: "List all the work items in a given iteration", - Action: ListItemsInIteration, - Aliases: []string{"ii"}, - Flags: []cli.Flag{ - cli.StringFlag{Name: "board", Value: "Stories", Usage: "Display board by type"}, - cli.StringFlag{Name: "filter-tag", Value: "", Usage: "Filter by a given tag"}, - cli.StringFlag{Name: "hide-tag", Value: "", Usage: "Hide items with a given tag"}, - }, - Category: "iteration", - }, - { - Name: "iteration:list", - Usage: "List all the iterations", - Action: ListIterations, - Aliases: []string{"il"}, - Category: "iteration", - }, - { - Name: "iteration:people", - Usage: "Show people based data for the iteration", - Action: ShowIterationPeopleBreakdown, - Aliases: []string{"ip"}, - Category: "iteration", - }, - { - Name: "plan:list", - Usage: "List all the delivery plans", - Action: ListDeliveryPlans, - Aliases: []string{"pll"}, - Category: "plans", - }, - { - Name: "plan:timeline", - Usage: "Show the timeline for the delivery plan", - Action: GetDeliveryPlanTimeLine, - Aliases: []string{"plt"}, - Flags: []cli.Flag{ - cli.BoolFlag{Name: "show-tags", Usage: "Should we show any tags for the items in the plan"}, - }, - Category: "plans", - }, - { - Name: "pr:list", - Usage: "List all the pull requests", - Action: ListPullRequests, - Aliases: []string{"pul"}, - Flags: []cli.Flag{ - cli.StringFlag{Name: "state", Value: "active", Usage: "Filter by pull request state"}, - cli.StringFlag{Name: "repo", Value: ".*", Usage: "Filter by repo name"}, - cli.IntFlag{Name: "count", Value: 10, Usage: "How many pull requests to display"}, - }, - Category: "pull requests", - }, - { - Name: "t:list", - Usage: "List all the teams", - Action: ListTeams, - Aliases: []string{"tl"}, - Flags: []cli.Flag{ - cli.BoolFlag{Name: "mine", Usage: "Show my teams only"}, - }, - Category: "teams", - }, - } - - app.Run(os.Args) + cmd.Execute() } diff --git a/pull_request.go b/pull_request.go deleted file mode 100644 index fe731e4..0000000 --- a/pull_request.go +++ /dev/null @@ -1,72 +0,0 @@ -package main - -import ( - "fmt" - "os" - "regexp" - "text/tabwriter" - "time" - - "github.com/benmatselby/go-azuredevops/azuredevops" - "github.com/urfave/cli" -) - -// ListPullRequests will call the API and get a list of iterations -func ListPullRequests(c *cli.Context) { - state := c.String("state") - count := c.Int("count") - filterRepo := c.String("repo") - - options := &azuredevops.PullRequestListOptions{State: state} - pulls, _, err := client.PullRequests.List(options) - if err != nil { - fmt.Fprintf(os.Stderr, "could not get list of pull requests: %v", err) - os.Exit(2) - } - - if len(pulls) == 0 { - return - } - - if len(pulls) < count { - count = len(pulls) - } - - w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', tabwriter.FilterHTML) - fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", "", "ID", "Title", "Repo", "Created") - - for index := 0; index < count; index++ { - pull := pulls[index] - - repoName := pull.Repo.Name - - // Filter on branches - matched, _ := regexp.MatchString(".*"+filterRepo+".*", repoName) - if matched == false { - continue - } - - title := pull.Title - status := pull.Status - - // Deal with date formatting - when, err := time.Parse(time.RFC3339, pull.Created) - created := when.Format(appDateTimeFormat) - if err != nil { - created = pull.Created - } - - var result string - if status == "completed" { - result = appSuccess - } else if status == "abandoned" { - result = appStale - } else { - result = appPending - } - - fmt.Fprintf(w, "%s \t%d\t%s\t%s\t%s\n", result, pull.ID, title, repoName, created) - } - - w.Flush() -} diff --git a/sonar-project.properties b/sonar-project.properties deleted file mode 100644 index 71a8a76..0000000 --- a/sonar-project.properties +++ /dev/null @@ -1,13 +0,0 @@ -sonar.host.url=https://sonarcloud.io -sonar.organization=benmatselby -sonar.projectKey=donny -sonar.projectName=donny - -sonar.sources=. -sonar.exclusions=*_test.go - -sonar.tests=. -sonar.test.inclusions=*_test.go - -sonar.go.tests.reportPaths=coverage.out -sonar.go.coverage.reportPaths=coverage.out diff --git a/team.go b/team.go deleted file mode 100644 index 0ba1b26..0000000 --- a/team.go +++ /dev/null @@ -1,37 +0,0 @@ -package main - -import ( - "fmt" - "os" - "sort" - "text/tabwriter" - - "github.com/benmatselby/go-azuredevops/azuredevops" - "github.com/urfave/cli" -) - -// ListTeams will return all the teams for the organisation -func ListTeams(c *cli.Context) { - filterMine := c.Bool("mine") - - opts := azuredevops.TeamsListOptions{ - Mine: filterMine, - } - teams, _, err := client.Teams.List(&opts) - if err != nil { - fmt.Fprintf(os.Stderr, "unable to get teams: %+v", err) - os.Exit(2) - } - - sort.Slice(teams, func(i, j int) bool { - return teams[i].Name < teams[j].Name - }) - - w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', tabwriter.FilterHTML) - - for _, team := range teams { - fmt.Fprintf(w, "%s\n", team.Name) - } - - w.Flush() -} diff --git a/ui/ui.go b/ui/ui.go new file mode 100644 index 0000000..a2beb43 --- /dev/null +++ b/ui/ui.go @@ -0,0 +1,12 @@ +package ui + +const ( + AppDateFormat string = "02-01-2006" + AppDateTimeFormat string = "02-01-2006 15:04" + AppSuccess string = "✅" + AppFailure string = "❌" + AppPending string = "🗂" + AppProgress string = "🏗" + AppStale string = "🕳" + AppUnknown string = "❓" +)