xbps-uhelper: add verbose output for cmpver/pkgmatch

I can never remember which retval means which thing. This only prints if
-v/--verbose is specified.

Examples:
```
$ ./bin/xbps-uhelper/xbps-uhelper -v cmpver 1 2 ; echo ret: $?
1 < 2
ret: 255
$ ./bin/xbps-uhelper/xbps-uhelper -v cmpver 1 1 ; echo ret: $?
1 = 1
ret: 0
$ ./bin/xbps-uhelper/xbps-uhelper -v cmpver 2 1 ; echo ret: $?
2 > 1
ret: 1
$ ./bin/xbps-uhelper/xbps-uhelper -v pkgmatch 'foo-1.0_1' 'foo>=0' ; echo ret: $?
foo-1.0_1 matches foo>=0
ret: 1
$ ./bin/xbps-uhelper/xbps-uhelper -v pkgmatch 'foo-1.0_1' 'foo<0.1_1' ; echo ret: $?
foo-1.0_1 does not match foo<0.1_1
ret: 0
```

it also seems that getting an error from pkgmatch is currently impossible
This commit is contained in:
classabbyamp
2023-03-29 16:04:38 -04:00
committed by Duncan Overbruck
parent b5b26630e9
commit 50fb2017d0
3 changed files with 44 additions and 8 deletions

View File

@@ -229,10 +229,7 @@ _xbps_uchroot() {
_xbps_uhelper() {
local ret=1
_arguments \
{-C,--config=-}'[Full path to configuration file]:config file:_files' \
{-d,--debug}'[Debug mode shown to stderr]' \
{-r,--rootdir=-}'[Full path to rootdir]:root dir:_files -/' \
{-V,--version}'[Show XBPS version]' \
$_xbps_common \
'1:action:->actions' \
'*:: :->args' && ret=0
case $state in