locate: Accept ‘--clear’ without additional arguments.
Fixes a bug whereby ‘guix locate --clear’ would end with the “no files to search for” error. Fixes <https://issues.guix.gnu.org/66799>. * guix/scripts/locate.scm (guix-locate): Do not emit “no files to search for” error when 'clear? is set in OPTS. * tests/guix-locate.sh: Test it. Reported-by: Maciej Kalandyk <m.kalandyk@outlook.com> Change-Id: Ib8fa125c18481d7f5408bd89df9503713527641d
This commit is contained in:
parent
3fe31e37a9
commit
69d9a02094
@ -657,7 +657,7 @@ Locate FILE and return the list of packages that contain it.\n"))
|
|||||||
files)))
|
files)))
|
||||||
(()
|
(()
|
||||||
(if (null? files)
|
(if (null? files)
|
||||||
(unless update?
|
(unless (or update? (assoc-ref opts 'clear?))
|
||||||
(leave (G_ "no files to search for~%")))
|
(leave (G_ "no files to search for~%")))
|
||||||
(leave (N_ "file~{ '~a'~} not found in database '~a'~%"
|
(leave (N_ "file~{ '~a'~} not found in database '~a'~%"
|
||||||
"files~{ '~a'~} not found in database '~a'~%"
|
"files~{ '~a'~} not found in database '~a'~%"
|
||||||
|
@ -70,3 +70,9 @@ then
|
|||||||
$cmd_store guile | grep "$(guix build guile-bootstrap)/bin/guile"
|
$cmd_store guile | grep "$(guix build guile-bootstrap)/bin/guile"
|
||||||
$cmd_store boot-9.scm | grep ^guile-bootstrap
|
$cmd_store boot-9.scm | grep ^guile-bootstrap
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# The command below is an error: "no files to search for"...
|
||||||
|
guix locate && false
|
||||||
|
|
||||||
|
# ... but this one is fine.
|
||||||
|
guix locate --clear
|
||||||
|
Loading…
Reference in New Issue
Block a user