Made requested changes

Sladyn created

Made changes to the doc files and remaining areas which required updation.

Change summary

bug/snapshot.go      |  8 --------
cache/bug_excerpt.go | 29 ++++++-----------------------
cache/query.go       |  4 ++++
cache/query_test.go  |  3 +++
commands/ls.go       |  6 +++++-
doc/queries.md       | 10 ++++++++++
input/input.go       |  1 +
7 files changed, 29 insertions(+), 32 deletions(-)

Detailed changes

bug/snapshot.go 🔗

@@ -34,14 +34,6 @@ func (snap *Snapshot) HumanId() string {
 	return FormatHumanID(snap.id)
 }
 
-// Deprecated:should be moved in UI code
-func (snap *Snapshot) Summary() string {
-	return fmt.Sprintf("C:%d L:%d",
-		len(snap.Comments)-1,
-		len(snap.Labels),
-	)
-}
-
 // Return the last time a bug was modified
 func (snap *Snapshot) LastEditTime() time.Time {
 	if len(snap.Operations) == 0 {

cache/bug_excerpt.go 🔗

@@ -23,16 +23,11 @@ type BugExcerpt struct {
 	CreateUnixTime    int64
 	EditUnixTime      int64
 
-	Title        string
-	Status       bug.Status
-	NoOfComments int
-	Labels       []bug.Label
-
-	// If author is identity.Bare, LegacyAuthor is set
-	// If author is identity.Identity, AuthorId is set and data is deported
-	// in a IdentityExcerpt
-	LegacyAuthor LegacyAuthorExcerpt
-	AuthorId     string
+	Title       string
+	Status      bug.Status
+	Author      identity.Interface
+	LenComments int
+	Labels      []bug.Label
 
 	CreateMetadata map[string]string
 }
@@ -53,22 +48,10 @@ func NewBugExcerpt(b bug.Interface, snap *bug.Snapshot) *BugExcerpt {
 		Title:             snap.Title,
 		Status:            snap.Status,
 		Labels:            snap.Labels,
-		NoOfComments:      len(snap.Comments),
+		LenComments:       len(snap.Comments),
 		CreateMetadata:    b.FirstOp().AllMetadata(),
 	}
 
-	switch snap.Author.(type) {
-	case *identity.Identity:
-		e.AuthorId = snap.Author.Id()
-	case *identity.Bare:
-		e.LegacyAuthor = LegacyAuthorExcerpt{
-			Login: snap.Author.Login(),
-			Name:  snap.Author.Name(),
-		}
-	default:
-		panic("unhandled identity type")
-	}
-
 	return e
 }
 

cache/query.go 🔗

@@ -60,6 +60,10 @@ func ParseQuery(query string) (*Query, error) {
 			f := LabelFilter(qualifierQuery)
 			result.Label = append(result.Label, f)
 
+		case "title":
+			f := TitleFilter(qualifierQuery)
+			result.Label = append(result.Title, f)
+
 		case "no":
 			err := result.parseNoFilter(qualifierQuery)
 			if err != nil {

cache/query_test.go 🔗

@@ -22,6 +22,9 @@ func TestQueryParse(t *testing.T) {
 		{"label:hello", true},
 		{`label:"Good first issue"`, true},
 
+		{"title:Bug titleOne", true},
+		{`title:"Bug titleTwo"`, true},
+
 		{"sort:edit", true},
 		{"sort:unknown", false},
 	}

commands/ls.go 🔗

@@ -55,11 +55,15 @@ func runLsBug(cmd *cobra.Command, args []string) error {
 		authorFmt := fmt.Sprintf("%-15.15s", b.Author.Name)
 
 		fmt.Printf("%s %s\t%s\t%s\tC:%d L:%d\n",
+<<<<<<< HEAD
 			colors.Cyan(b.HumanId()),
+=======
+			colors.Cyan(b.Id),
+>>>>>>> Made requested changes
 			colors.Yellow(b.Status),
 			titleFmt,
 			colors.Magenta(authorFmt),
-			b.NoOfComments,
+			b.LenComments,
 			len(b.Labels),
 		)
 	}

doc/queries.md 🔗

@@ -42,6 +42,16 @@ You can filter based on the bug's label.
 | `label:LABEL` | `label:prod` matches bugs with the label `prod`                           |
 |               | `label:"Good first issue"` matches bugs with the label `Good first issue` |
 
+### Filtering by title
+
+You can filter based on the bug's title.
+
+| Qualifier     | Example                                                                   |
+| ---           | ---                                                                       |
+| `title:TITLE` | `title:Critical` matches bugs with the title `Critical`                   |
+|               | `title:"Typo in string"` matches bugs with the title `Typo in string`     |
+
+
 ### Filtering by missing feature
 
 You can filter bugs based on the absence of something.

input/input.go 🔗

@@ -193,6 +193,7 @@ const queryTemplate = `%s
 #
 # - status:open, status:closed
 # - author:<query>
+# - title:<title>
 # - label:<label>
 # - no:label
 #