Skip to content

Commit

Permalink
Support all the new search "by" options
Browse files Browse the repository at this point in the history
  • Loading branch information
falconindy committed Aug 10, 2024
1 parent b4b9050 commit d52bba1
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 3 deletions.
4 changes: 3 additions & 1 deletion extra/bash_completion
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ _auracle() {
comps='always never auto'
;;
'--searchby')
comps='name name-desc maintainer depends makedepends optdepends checkdepends'
comps='name name-desc maintainer depends makedepends optdepends
checkdepends submitter provides conflicts replaces
keywords groups maintainers'
;;
'--sort'|'--rsort')
comps="name votes popularity firstsubmitted lastmodified"
Expand Down
2 changes: 1 addition & 1 deletion extra/zsh_completion
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ _arguments -S \
{--quiet,-q}'[Output less, when possible]' \
{--recurse,-r}'[Recurse through dependencies on download]' \
'--literal[Disallow regex in searches]' \
'--searchby=[Change search-by dimension]: :(name name-desc maintainer depends makedepends optdepends checkdepends)' \
'--searchby=[Change search-by dimension]: :(name name-desc maintainer depends makedepends optdepends checkdepends submitter provides conflicts replaces keywords groups comaintainers)' \
'--color=[Control colored output]: :(auto never always)' \
{--chdir=,-C+}'[Change directory before downloading]:directory:_files -/' \
{--format=,-F+}'[Specify custom output for search and info]' \
Expand Down
4 changes: 3 additions & 1 deletion man/auracle.1.pod
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ Is the same as I<depends,makedepends> or I<^checkdepends>.

When used with the B<search> and B<rawsearch> commands, change the search
dimension. I<BY> must be one of I<name>, I<name-desc>, I<maintainer>,
I<depends>, I<makedepends>, I<optdepends>, or I<checkdepends>.
I<depends>, I<makedepends>, I<optdepends>, I<checkdepends>, I<submitter>,
I<provides>, I<conflicts>, I<replaces>, I<keywords>, I<groups>, or
I<comaintainers>.

This option defaults to I<name-desc>.

Expand Down
42 changes: 42 additions & 0 deletions src/aur/request.hh
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ class SearchRequest : public RpcRequest {
MAKEDEPENDS,
OPTDEPENDS,
CHECKDEPENDS,
SUBMITTER,
PROVIDES,
CONFLICTS,
REPLACES,
KEYWORDS,
GROUPS,
COMAINTAINERS,
};

static SearchBy ParseSearchBy(std::string_view searchby) {
Expand All @@ -146,6 +153,27 @@ class SearchRequest : public RpcRequest {
if (searchby == "checkdepends") {
return SearchBy::CHECKDEPENDS;
}
if (searchby == "submitter") {
return SearchBy::SUBMITTER;
}
if (searchby == "provides") {
return SearchBy::PROVIDES;
}
if (searchby == "conflicts") {
return SearchBy::CONFLICTS;
}
if (searchby == "replaces") {
return SearchBy::REPLACES;
}
if (searchby == "keywords,") {
return SearchBy::KEYWORDS;
}
if (searchby == "groups") {
return SearchBy::GROUPS;
}
if (searchby == "comaintainers") {
return SearchBy::COMAINTAINERS;
}
return SearchBy::INVALID;
}

Expand Down Expand Up @@ -178,6 +206,20 @@ class SearchRequest : public RpcRequest {
return "optdepends";
case SearchBy::CHECKDEPENDS:
return "checkdepends";
case SearchBy::SUBMITTER:
return "submitter";
case SearchBy::PROVIDES:
return "provides";
case SearchBy::CONFLICTS:
return "conflicts";
case SearchBy::REPLACES:
return "replaces";
case SearchBy::KEYWORDS:
return "keywords";
case SearchBy::GROUPS:
return "groups";
case SearchBy::COMAINTAINERS:
return "comaintainers";
default:
return "";
}
Expand Down

0 comments on commit d52bba1

Please sign in to comment.