Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Command = &cobra.Command{ Use: "user-activity-report", Short: "Generate a user activity report", RunE: func(cmd *cobra.Command, args []string) error { jiraService := jira.GetService() if jiraService == nil { return fmt.Errorf("Jira service not initialized") } board, err := jiraService.GetBoardForProjectKey(projectKey, int(boardID)) if err != nil { return err } sprint, err := jiraService.GetSprintForBoard(board, int(sprintID)) if err != nil { return err } issues, err := jiraService.GetIssuesForSprint(sprint) if err != nil { return err } w := tabwriter.NewWriter(os.Stdout, 0, 0, 3, ' ', 0) fmt.Fprintf(w, "\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n") for _, issue := range issues { sort.Slice(issue.Changelog.Histories, func(i, j int) bool { a, _ := issue.Changelog.Histories[i].CreatedTime() b, _ := issue.Changelog.Histories[j].CreatedTime() return a.Before(b) }) if issue.Fields.Epic == nil { continue } if epicFilterSummaryRegex != "" && !regexp.MustCompile(epicFilterSummaryRegex).Match([]byte(issue.Fields.Epic.Name)) { continue } fmt.Fprintf(w, issue.Key+" - "+issue.Fields.Summary+"\n\n") currentCreatedDate := "" for _, history := range issue.Changelog.Histories { for _, item := range history.Items { doable := false for _, f := range strings.Split(fieldList, ",") { if strings.ToUpper(item.Field) == strings.ToUpper(f) { doable = true break } } if doable { t, _ := history.CreatedTime() c := t.Format("Mon, Jan 02, 15:04") line := "" if t.After(*sprint.StartDate) && t.Before(*sprint.CompleteDate) { line += "*" } line += "\t" if c != currentCreatedDate { line += c + "\t" } else { line += "\t" } line += strings.Title(item.Field) + "\t" line += strings.Title(item.FromString) + " -> " + strings.Title(item.ToString) fmt.Fprintf(w, line+"\n") currentCreatedDate = c } } } fmt.Fprintf(w, "\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n") } w.Flush() return nil }, }
Command pointer
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.