Detailed changes
@@ -2,6 +2,7 @@ package cache
import (
"encoding/gob"
+ "fmt"
"github.com/MichaelMure/git-bug/bug"
"github.com/MichaelMure/git-bug/identity"
@@ -45,6 +46,19 @@ type LegacyAuthorExcerpt struct {
Login string
}
+func (l LegacyAuthorExcerpt) DisplayName() string {
+ switch {
+ case l.Name == "" && l.Login != "":
+ return l.Login
+ case l.Name != "" && l.Login == "":
+ return l.Name
+ case l.Name != "" && l.Login != "":
+ return fmt.Sprintf("%s (%s)", l.Name, l.Login)
+ }
+
+ panic("invalid person data")
+}
+
func NewBugExcerpt(b bug.Interface, snap *bug.Snapshot) *BugExcerpt {
participantsIds := make([]string, len(snap.Participants))
for i, participant := range snap.Participants {
@@ -52,9 +52,21 @@ func runLsBug(cmd *cobra.Command, args []string) error {
return err
}
+ var name string
+ if b.AuthorId != "" {
+ author, err := backend.ResolveIdentityExcerpt(b.AuthorId)
+ if err != nil {
+ name = "<missing author data>"
+ } else {
+ name = author.DisplayName()
+ }
+ } else {
+ name = b.LegacyAuthor.DisplayName()
+ }
+
// truncate + pad if needed
titleFmt := fmt.Sprintf("%-50.50s", b.Title)
- authorFmt := fmt.Sprintf("%-15.15s", b.LegacyAuthor.Name)
+ authorFmt := fmt.Sprintf("%-15.15s", name)
fmt.Printf("%s %s\t%s\t%s\tC:%d L:%d\n",
colors.Cyan(b.HumanId()),
@@ -30,6 +30,14 @@ You can pass an additional query to filter and order the list. This query can be
\fB\-a\fP, \fB\-\-author\fP=[]
Filter by author
+.PP
+\fB\-p\fP, \fB\-\-participant\fP=[]
+ Filter by participant
+
+.PP
+\fB\-A\fP, \fB\-\-actor\fP=[]
+ Filter by actor
+
.PP
\fB\-l\fP, \fB\-\-label\fP=[]
Filter by label
@@ -21,7 +21,7 @@ Display the details of a bug.
.SH OPTIONS
.PP
\fB\-f\fP, \fB\-\-field\fP=""
- Select field to display. Valid values are [author,authorEmail,createTime,humanId,id,labels,shortId,status,title]
+ Select field to display. Valid values are [author,authorEmail,createTime,humanId,id,labels,shortId,status,title,actors,participants]
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
@@ -26,14 +26,16 @@ git bug ls --status closed --by creation
### Options
```
- -s, --status strings Filter by status. Valid values are [open,closed]
- -a, --author strings Filter by author
- -l, --label strings Filter by label
- -t, --title strings Filter by title
- -n, --no strings Filter by absence of something. Valid values are [label]
- -b, --by string Sort the results by a characteristic. Valid values are [id,creation,edit] (default "creation")
- -d, --direction string Select the sorting direction. Valid values are [asc,desc] (default "asc")
- -h, --help help for ls
+ -s, --status strings Filter by status. Valid values are [open,closed]
+ -a, --author strings Filter by author
+ -p, --participant strings Filter by participant
+ -A, --actor strings Filter by actor
+ -l, --label strings Filter by label
+ -t, --title strings Filter by title
+ -n, --no strings Filter by absence of something. Valid values are [label]
+ -b, --by string Sort the results by a characteristic. Valid values are [id,creation,edit] (default "creation")
+ -d, --direction string Select the sorting direction. Valid values are [asc,desc] (default "asc")
+ -h, --help help for ls
```
### SEE ALSO
@@ -13,7 +13,7 @@ git-bug show [<id>] [flags]
### Options
```
- -f, --field string Select field to display. Valid values are [author,authorEmail,createTime,humanId,id,labels,shortId,status,title]
+ -f, --field string Select field to display. Valid values are [author,authorEmail,createTime,humanId,id,labels,shortId,status,title,actors,participants]
-h, --help help for show
```
@@ -532,6 +532,12 @@ _git-bug_ls()
flags+=("--author=")
two_word_flags+=("-a")
local_nonpersistent_flags+=("--author=")
+ flags+=("--participant=")
+ two_word_flags+=("-p")
+ local_nonpersistent_flags+=("--participant=")
+ flags+=("--actor=")
+ two_word_flags+=("-A")
+ local_nonpersistent_flags+=("--actor=")
flags+=("--label=")
two_word_flags+=("-l")
local_nonpersistent_flags+=("--label=")