aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--commands/ls.go30
-rw-r--r--commands/show.go41
2 files changed, 57 insertions, 14 deletions
diff --git a/commands/ls.go b/commands/ls.go
index 75819f1a..ca74cc46 100644
--- a/commands/ls.go
+++ b/commands/ls.go
@@ -11,13 +11,15 @@ import (
)
var (
- lsStatusQuery []string
- lsAuthorQuery []string
- lsTitleQuery []string
- lsLabelQuery []string
- lsNoQuery []string
- lsSortBy string
- lsSortDirection string
+ lsStatusQuery []string
+ lsAuthorQuery []string
+ lsParticipantQuery []string
+ lsLabelQuery []string
+ lsTitleQuery []string
+ lsActorQuery []string
+ lsNoQuery []string
+ lsSortBy string
+ lsSortDirection string
)
func runLsBug(cmd *cobra.Command, args []string) error {
@@ -89,6 +91,16 @@ func lsQueryFromFlags() (*cache.Query, error) {
query.Author = append(query.Author, f)
}
+ for _, actor := range lsActorQuery {
+ f := cache.ActorFilter(actor)
+ query.Actor = append(query.Actor, f)
+ }
+
+ for _, participant := range lsParticipantQuery {
+ f := cache.ParticipantFilter(participant)
+ query.Participant = append(query.Participant, f)
+ }
+
for _, label := range lsLabelQuery {
f := cache.LabelFilter(label)
query.Label = append(query.Label, f)
@@ -151,6 +163,10 @@ func init() {
"Filter by status. Valid values are [open,closed]")
lsCmd.Flags().StringSliceVarP(&lsAuthorQuery, "author", "a", nil,
"Filter by author")
+ lsCmd.Flags().StringSliceVarP(&lsParticipantQuery, "participant", "p", nil,
+ "Filter by participant")
+ lsCmd.Flags().StringSliceVarP(&lsActorQuery, "actor", "A", nil,
+ "Filter by actor")
lsCmd.Flags().StringSliceVarP(&lsLabelQuery, "label", "l", nil,
"Filter by label")
lsCmd.Flags().StringSliceVarP(&lsTitleQuery, "title", "t", nil,
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]")
}