Skip to content

Commit

Permalink
bin/xbps-query: fix -R/--repository parsing
Browse files Browse the repository at this point in the history
this makes the behaviour match what xbps-install et al. do, namely
-R <repo> and --repository <repo> now work. Existing behaviours are
preserved.
  • Loading branch information
classabbyamp committed Feb 27, 2024
1 parent e82437f commit da46796
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion bin/xbps-query/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ usage(bool fail)
" -p, --property PROP[,...] Show properties for PKGNAME\n"
" -R, --repository Enable repository mode. This mode explicitly\n"
" looks for packages in repositories\n"
" --repository=<url> Enable repository mode and add repository\n"
" -R, --repository <url> Enable repository mode and add repository\n"
" to the top of the list. This option can be\n"
" specified multiple times\n"
" --regex Use Extended Regular Expressions to match\n"
Expand Down Expand Up @@ -171,6 +171,9 @@ main(int argc, char **argv)
show_prop = true;
break;
case 'R':
if (optarg == NULL && optind < argc && argv[optind][0] != '-') {
optarg = argv[optind++];
}
if (optarg != NULL) {
xbps_repo_store(&xh, optarg);
}
Expand Down
4 changes: 2 additions & 2 deletions bin/xbps-query/xbps-query.1
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ Multiple properties can be specified by delimiting them with commas.
For a list of available properties, see the
.Sx PROPERTIES
section.
.It Fl R
.It Fl R , Fl -repository
Enable repository mode.
This mode explicitly looks in repositories, rather
than looking in the target root directory.
.It Fl -repository=url
.It Fl R , Fl -repository Ar url
Appends the specified repository to the top of the list.
The
.Ar url
Expand Down

0 comments on commit da46796

Please sign in to comment.