diff --git a/README.md b/README.md index e0861e3..10551e0 100644 --- a/README.md +++ b/README.md @@ -81,5 +81,7 @@ bb help [COMMAND] - issue list - add way to sort by recent or the ones the user has participated on - issue log - is broken, and doesn't use current branch as issue key +- issue edit - edit issue title and maybe some tags - View/Edit issue checklist +- pr list - add timings information with a flag diff --git a/api/jira-types.go b/api/jira-types.go index 6c2d375..5a4f237 100644 --- a/api/jira-types.go +++ b/api/jira-types.go @@ -30,6 +30,18 @@ type JiraIssue struct { Id string } Parent struct { + Key string `json:"key"` + Fields struct { + Summary string + Type struct { + Name string + Subtask bool + } `json:"issuetype"` + Priority struct { + Name string + Id string + } + } } Project struct { Name string @@ -59,8 +71,8 @@ type JiraIssue struct { type UpdateIssueRequestBody struct { Fields struct { // This on might be enough when set on project - TimeTracking *TimeTracking `json:"timetracking,omitempty"` - Summary string `json:"summary,omitempty"` + TimeTracking *TimeTracking `json:"timetracking,omitempty"` + Summary string `json:"summary,omitempty"` } `json:"fields,omitempty"` Update struct { TimeTracking []UpdateType[TimeTracking] `json:"timetracking,omitempty"` diff --git a/cmd/issue/list.go b/cmd/issue/list.go index e508756..eadac70 100644 --- a/cmd/issue/list.go +++ b/cmd/issue/list.go @@ -30,6 +30,7 @@ var ListCmd = &cobra.Command{ priority, _ := cmd.Flags().GetBool("priority") showUsers, _ := cmd.Flags().GetBool("users") showTime, _ := cmd.Flags().GetBool("time") + showParents, _ := cmd.Flags().GetBool("parent") project := "" if len(args) == 0 { @@ -76,13 +77,20 @@ var ListCmd = &cobra.Command{ timeSpent = issue.Fields.TimeTracking.TimeSpent } util.Printf("%s \033[1;32m%s\033[m %s %s %s\n", util.FormatIssueStatus(issue.Fields.Status.Name), issue.Key, util.FormatIssueType(issue.Fields.Type.Name), issue.Fields.Summary, util.FormatIssuePriority(issue.Fields.Priority.Id, issue.Fields.Priority.Name)) + if showParents { + if issue.Fields.Parent.Fields.Summary != "" { + util.Printf(" \033[37mParent:\033[m %s %s (\033[37m%s\033[m)\n", util.FormatIssueType(issue.Fields.Parent.Fields.Type.Name), issue.Fields.Parent.Fields.Summary, issue.Fields.Parent.Key) + } else { + util.Printf(" \033[37mParent: ---\n") + } + } if showUsers { if all { - util.Printf(" \033[37mAssigned: \033[1m%s\033[0;37m -> Reporter: \033[1;36m%s\033[m \033[37m(%d comments)\033[m\n", issue.Fields.Assignee.DisplayName, issue.Fields.Reporter.DisplayName, issue.Fields.Comment.Total) + util.Printf(" \033[37mAssigned: \033[1m%s\033[0;37m -> Reporter: \033[1;36m%s\033[m \033[m\033[37m(%d comments)\033[m\n", issue.Fields.Assignee.DisplayName, issue.Fields.Reporter.DisplayName, issue.Fields.Comment.Total) } else if reporter { - util.Printf(" \033[37mAssigned: \033[1m%s \033[37m(%d comments)\033[m\n", issue.Fields.Assignee.DisplayName, issue.Fields.Comment.Total) + util.Printf(" \033[37mAssigned: \033[1m%s \033[m\033[37m(%d comments)\033[m\n", issue.Fields.Assignee.DisplayName, issue.Fields.Comment.Total) } else { - util.Printf(" \033[37mReporter: \033[1m%s \033[37m(%d comments)\033[m\n", issue.Fields.Reporter.DisplayName, issue.Fields.Comment.Total) + util.Printf(" \033[37mReporter: \033[1m%s \033[m\033[37m(%d comments)\033[m\n", issue.Fields.Reporter.DisplayName, issue.Fields.Comment.Total) } } if showTime { @@ -107,6 +115,7 @@ func init() { // display ListCmd.Flags().BoolP("users", "u", false, "show users") ListCmd.Flags().BoolP("time", "t", false, "show time information") + ListCmd.Flags().BoolP("parent", "p", true, "show parent tickets") ListCmd.Flags().IntP("number-results", "n", 10, "max number of results retrieve") // sort ListCmd.Flags().BoolP("priority", "P", false, "sort by priority") diff --git a/cmd/issue/view.go b/cmd/issue/view.go index 57d5f92..e015456 100644 --- a/cmd/issue/view.go +++ b/cmd/issue/view.go @@ -35,6 +35,11 @@ var ViewCmd = &cobra.Command{ util.Printf("%s \033[1;32m%s\033[m %s %s %s\n", util.FormatIssueStatus(issue.Fields.Status.Name), issue.Key, util.FormatIssueType(issue.Fields.Type.Name), issue.Fields.Summary, util.FormatIssuePriority(issue.Fields.Priority.Id, issue.Fields.Priority.Name)) util.Printf(" Assigned: \033[1;33m%s\033[m -> Reporter: \033[1;36m%s\033[m \033[37m(%d comments)\n", issue.Fields.Assignee.DisplayName, issue.Fields.Reporter.DisplayName, issue.Fields.Comment.Total) util.Printf(" Time spent: \033[1;34m%s\033[m [ %s/%s ]\n", timeSpent, issue.Fields.TimeTracking.RemainingEstimate, issue.Fields.TimeTracking.OriginalEstimate) + if issue.Fields.Parent.Fields.Summary != "" { + util.Printf(" \033[37mParent:\033[m %s %s (\033[37m%s\033[m)\n", util.FormatIssueType(issue.Fields.Parent.Fields.Type.Name), issue.Fields.Parent.Fields.Summary, issue.Fields.Parent.Key) + } else { + util.Printf(" \033[37mParent: ---\n") + } fmt.Println() web, _ := cmd.Flags().GetBool("web") diff --git a/cmd/root.go b/cmd/root.go index 905cd60..7d237a7 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -17,8 +17,9 @@ var cfgFile string var RootCmd = &cobra.Command{ Use: "bb", - Short: "bb is a bitbucket cli", - Long: `Bitbucket cli to interact with bitbucket.org`, + Short: "CLI utility to manage Bitbucket repositories and Jira organizations", + Long: `This utility is focused on allowing simple operations on bitbucket and jira through the command line. + It provides commands to operate on Bitbucket and Jira.`, } // Execute adds all child commands to the root command and sets flags appropriately.