Skip to content

Commit

Permalink
fix(cmd): qri list should match against peername and dataset name
Browse files Browse the repository at this point in the history
  • Loading branch information
Arqu committed Apr 2, 2020
1 parent ff5bdeb commit eb38505
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
24 changes: 12 additions & 12 deletions base/dataset.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,6 @@ func ListDatasets(ctx context.Context, r repo.Repo, term string, limit, offset i
return nil, fmt.Errorf("error getting dataset list: %s", err.Error())
}

if term != "" {
matched := make([]reporef.DatasetRef, len(res))
i := 0
for _, ref := range res {
if strings.Contains(ref.Name, term) {
matched[i] = ref
i++
}
}
res = matched[:i]
}

if publishedOnly {
pub := make([]reporef.DatasetRef, len(res))
i := 0
Expand Down Expand Up @@ -174,6 +162,18 @@ func ListDatasets(ctx context.Context, r repo.Repo, term string, limit, offset i
}
}

if term != "" {
matched := make([]reporef.DatasetRef, len(res))
i := 0
for _, ref := range res {
if strings.Contains(ref.AliasString(), term) {
matched[i] = ref
i++
}
}
res = matched[:i]
}

return
}

Expand Down
2 changes: 1 addition & 1 deletion lib/datasets.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (r *DatasetRequests) List(p *ListParams, res *[]dsref.VersionInfo) error {
matched := make([]reporef.DatasetRef, len(refs))
count := 0
for _, ref := range refs {
if strings.Contains(ref.Name, p.Term) {
if strings.Contains(ref.AliasString(), p.Term) {
matched[count] = ref
count++
}
Expand Down

0 comments on commit eb38505

Please sign in to comment.