guix-package: Error out when passed a non-option argument.

* guix-package.in (guix-package)[parse-options]: Call `leave' when
  passed a non-option argument.
  Reported by Andreas Enge <andreas@enge.fr>.
* tests/guix-package.sh: Add test.
This commit is contained in:
Ludovic Courtès 2013-01-24 22:00:54 +01:00
parent 313b901255
commit 3b9c002088
2 changed files with 4 additions and 1 deletions

@ -326,7 +326,7 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
(lambda (opt name arg result)
(leave (_ "~A: unrecognized option~%") name))
(lambda (arg result)
(alist-cons 'argument arg result))
(leave (_ "~A: extraneous argument~%") arg))
%default-options))
(define (guile-missing?)

@ -139,3 +139,6 @@ fi
# Failed attempt to roll back.
if guix-package --bootstrap --roll-back;
then false; else true; fi
# Extraneous argument.
! guix-package install foo-bar