diff options
author | Amine Hilaly <hilalyamine@gmail.com> | 2019-04-05 16:42:45 +0200 |
---|---|---|
committer | Amine Hilaly <hilalyamine@gmail.com> | 2019-04-05 17:18:47 +0200 |
commit | 14ce66f0dde4345e6b08f528aa435196d132e2b8 (patch) | |
tree | d7f5eb05530ac5664fab840f9c56e497fac43233 /commands/show.go | |
parent | 16d2b92f0558184dde4151e96addaa621f51ac13 (diff) | |
download | git-bug-14ce66f0dde4345e6b08f528aa435196d132e2b8.tar.gz |
integrate actors and participant filters into ls and show commands
Diffstat (limited to 'commands/show.go')
-rw-r--r-- | commands/show.go | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/commands/show.go b/commands/show.go index f7f8ecd5..41dc5851 100644 --- a/commands/show.go +++ b/commands/show.go @@ -6,7 +6,7 @@ import ( "strings" "github.com/MichaelMure/git-bug/cache" - "github.com/MichaelMure/git-bug/commands/select" + _select "github.com/MichaelMure/git-bug/commands/select" "github.com/MichaelMure/git-bug/util/colors" "github.com/MichaelMure/git-bug/util/interrupt" "github.com/spf13/cobra" @@ -50,11 +50,17 @@ func runShowBug(cmd *cobra.Command, args []string) error { case "id": fmt.Printf("%s\n", snapshot.Id()) case "labels": - var labels = make([]string, len(snapshot.Labels)) - for i, l := range snapshot.Labels { - labels[i] = string(l) + for _, l := range snapshot.Labels { + fmt.Printf("%s\n", l.String()) + } + case "actors": + for _, a := range snapshot.Actors { + fmt.Printf("%s\n", a.DisplayName()) + } + case "participants": + for _, p := range snapshot.Participants { + fmt.Printf("%s\n", p.DisplayName()) } - fmt.Printf("%s\n", strings.Join(labels, "\n")) case "shortId": fmt.Printf("%s\n", snapshot.HumanId()) case "status": @@ -80,15 +86,36 @@ func runShowBug(cmd *cobra.Command, args []string) error { firstComment.FormatTimeRel(), ) + // Labels var labels = make([]string, len(snapshot.Labels)) for i := range snapshot.Labels { labels[i] = string(snapshot.Labels[i]) } - fmt.Printf("labels: %s\n\n", + fmt.Printf("labels: %s\n", strings.Join(labels, ", "), ) + // Actors + var actors = make([]string, len(snapshot.Actors)) + for i := range snapshot.Actors { + actors[i] = snapshot.Actors[i].DisplayName() + } + + fmt.Printf("actors: %s\n", + strings.Join(actors, ", "), + ) + + // Participants + var participants = make([]string, len(snapshot.Participants)) + for i := range snapshot.Participants { + participants[i] = snapshot.Participants[i].DisplayName() + } + + fmt.Printf("participants: %s\n\n", + strings.Join(participants, ", "), + ) + // Comments indent := " " @@ -126,5 +153,5 @@ var showCmd = &cobra.Command{ func init() { RootCmd.AddCommand(showCmd) showCmd.Flags().StringVarP(&showFieldsQuery, "field", "f", "", - "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]") } |