Skip to content

Commit 433634f

Browse files
classabbyampDuncaen
authored andcommitted
bin/xbps-query: separate -R and --repository
this allows --repository <repo> instead of --repository=<repo>
1 parent 2488468 commit 433634f

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

bin/xbps-query/main.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ usage(bool fail)
4646
" -M, --memory-sync Remote repository data is fetched and stored\n"
4747
" in memory, ignoring on-disk repodata archives\n"
4848
" -p, --property PROP[,...] Show properties for PKGNAME\n"
49-
" -R, --repository Enable repository mode. This mode explicitly\n"
49+
" -R Enable repository mode. This mode explicitly\n"
5050
" looks for packages in repositories\n"
51-
" --repository=<url> Enable repository mode and add repository\n"
51+
" --repository <url> Enable repository mode and add repository\n"
5252
" to the top of the list. This option can be\n"
5353
" specified multiple times\n"
5454
" --regex Use Extended Regular Expressions to match\n"
@@ -93,7 +93,7 @@ main(int argc, char **argv)
9393
{ "list-orphans", no_argument, NULL, 'O' },
9494
{ "ownedby", no_argument, NULL, 'o' },
9595
{ "property", required_argument, NULL, 'p' },
96-
{ "repository", optional_argument, NULL, 'R' },
96+
{ "repository", required_argument, NULL, 4 },
9797
{ "rootdir", required_argument, NULL, 'r' },
9898
{ "show", no_argument, NULL, 'S' },
9999
{ "search", no_argument, NULL, 's' },
@@ -169,9 +169,6 @@ main(int argc, char **argv)
169169
show_prop = true;
170170
break;
171171
case 'R':
172-
if (optarg != NULL) {
173-
xbps_repo_store(&xh, optarg);
174-
}
175172
repo_mode = true;
176173
break;
177174
case 'r':
@@ -207,6 +204,10 @@ main(int argc, char **argv)
207204
case 3:
208205
list_repolock = opmode = true;
209206
break;
207+
case 4:
208+
xbps_repo_store(&xh, optarg);
209+
repo_mode = true;
210+
break;
210211
case '?':
211212
default:
212213
usage(true);

bin/xbps-query/xbps-query.1

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ section.
109109
Enable repository mode.
110110
This mode explicitly looks in repositories, rather
111111
than looking in the target root directory.
112-
.It Fl -repository=url
113-
Appends the specified repository to the top of the list.
112+
.It Fl -repository Ar url
113+
Enables repository mode and adds the specified repository to the top of the list.
114114
The
115115
.Ar url
116116
argument expects a URL to the repository for remote repositories or
@@ -190,7 +190,7 @@ Lists packages that are in repolock mode.
190190
See the
191191
.Em PACKAGE MODES
192192
section for more information.
193-
.It Fl o, Fl -ownedby Ar PATTERN [ Fl -repository ] [ Fl -regex ]
193+
.It Fl o, Fl -ownedby Ar PATTERN [ Fl R ] [ Fl -regex ]
194194
Search for installed package files by matching
195195
.Ar PATTERN .
196196
The
@@ -203,22 +203,22 @@ or an Extended Regular Expression as explained in
203203
.Fl -regex
204204
option is set).
205205
If the
206-
.Fl -repository
206+
.Fl R
207207
option is set, the matched
208208
.Ar PATTERN
209209
in repositories will be shown.
210-
.It Fl S, Fl -show Ar PKG [ Fl -repository ] [ Fl -property Ar PROP ]
210+
.It Fl S, Fl -show Ar PKG [ Fl R ] [ Fl -property Ar PROP ]
211211
Shows information of an installed package.
212212
This is the default mode if no other mode is set.
213213
If the
214-
.Fl -repository
214+
.Fl R
215215
option is set, the matched
216216
.Ar PKG
217217
in repositories will be shown.
218218
If a package property is specified with
219219
.Fl -property,
220220
only that property will be shown.
221-
.It Fl s, Fl -search Ar PATTERN [ Fl -repository ] [ Fl -property Ar PROP ] [ Fl -regex ]
221+
.It Fl s, Fl -search Ar PATTERN [ Fl R ] [ Fl -property Ar PROP ] [ Fl -regex ]
222222
Search for packages by matching
223223
.Ar PATTERN
224224
on its
@@ -238,30 +238,30 @@ all packages matching
238238
against
239239
.Ar PROP
240240
will be shown.
241-
.It Fl f, Fl -files Ar PKG [ Fl -repository ]
241+
.It Fl f, Fl -files Ar PKG [ Fl R ]
242242
Show the package files for
243243
.Ar PKG .
244244
If the
245-
.Fl -repository
245+
.Fl R
246246
option is set, the matched
247247
.Ar PKG
248248
in repositories will be shown.
249-
.It Fl x, Fl -deps Ar PKG [ Fl -repository ]
249+
.It Fl x, Fl -deps Ar PKG [ Fl R ]
250250
Show the required dependencies for
251251
.Ar PKG .
252252
Only direct dependencies are shown.
253253
To see a full dependency tree, also set
254254
.Fl -fulldeptree .
255255
If the
256-
.Fl -repository
256+
.Fl R
257257
option is set, the matched
258258
.Ar PKG
259259
in repositories will be shown.
260-
.It Fl X, Fl -revdeps Ar PKG [ Fl -repository ]
260+
.It Fl X, Fl -revdeps Ar PKG [ Fl R ]
261261
Show the reverse dependencies for
262262
.Ar PKG .
263263
If the
264-
.Fl -repository
264+
.Fl R
265265
option is set, the matched
266266
.Ar PKG
267267
in repositories will be shown.

data/_xbps

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ _xbps_query() {
154154
{-p,--property=-}'[Show properties]:property:($_xbps_properties)' \
155155
--regex'[Use Extended Regular Expressions to match]' \
156156
--fulldeptree'[Full dependency tree for -x/--deps]' \
157-
{-R,--repository}'[Enable repository mode]' \
157+
-R'[Enable repository mode]' \
158158
'*'--repository=-'[Add repository to the top of the list]:repository url:_files -/' \
159159
- '(mode)' \
160160
{-l,--list-pkgs}'[List installed packages]' \

0 commit comments

Comments
 (0)