From da4679669579a803a0569cff6d8c4171986be9f6 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Tue, 27 Feb 2024 10:49:22 -0500 Subject: [PATCH] bin/xbps-query: fix -R/--repository parsing this makes the behaviour match what xbps-install et al. do, namely -R and --repository now work. Existing behaviours are preserved. --- bin/xbps-query/main.c | 5 ++++- bin/xbps-query/xbps-query.1 | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/xbps-query/main.c b/bin/xbps-query/main.c index 44316c1ad..04b320131 100644 --- a/bin/xbps-query/main.c +++ b/bin/xbps-query/main.c @@ -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= Enable repository mode and add repository\n" + " -R, --repository 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" @@ -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); } diff --git a/bin/xbps-query/xbps-query.1 b/bin/xbps-query/xbps-query.1 index b4c364180..407a8f60d 100644 --- a/bin/xbps-query/xbps-query.1 +++ b/bin/xbps-query/xbps-query.1 @@ -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