diff options
author | Ludovic Courtès <ludo@gnu.org> | 2017-10-27 13:28:00 -0700 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2017-10-28 09:45:53 +0200 |
commit | a1ff7e1d8dfb86ae1817d4e0db4ddeebd2083e83 (patch) | |
tree | 37ae378568444d592f17174bfc90533c55d18a38 /guix/scripts.scm | |
parent | ed1f071e98126ceb992faf5f22762f24d36ba9ff (diff) | |
download | gnu-guix-a1ff7e1d8dfb86ae1817d4e0db4ddeebd2083e83.tar gnu-guix-a1ff7e1d8dfb86ae1817d4e0db4ddeebd2083e83.tar.gz |
scripts: Factorize option parsing sans 'GUIX_BUILD_OPTIONS'.
* guix/scripts.scm (parse-command-line): Add #:build-options? parameter
and honor it.
* guix/scripts/challenge.scm (guix-challenge): Use 'parse-command-line'
with #:build-options? #f instead of 'args-fold*'.
* guix/scripts/gc.scm (guix-gc): Likewise.
* guix/scripts/graph.scm (guix-graph): Likewise.
* guix/scripts/hash.scm (guix-hash): Likewise.
* guix/scripts/lint.scm (guix-lint): Likewise.
* guix/scripts/refresh.scm (guix-refresh): Likewise.
* guix/scripts/size.scm (guix-size): Likewise.
* guix/scripts/weather.scm (guix-weather): Likewise.
Diffstat (limited to 'guix/scripts.scm')
-rw-r--r-- | guix/scripts.scm | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/guix/scripts.scm b/guix/scripts.scm index 9ff7f25548..4a7ae7baa3 100644 --- a/guix/scripts.scm +++ b/guix/scripts.scm @@ -67,11 +67,13 @@ reporting." (define* (parse-command-line args options seeds #:key + (build-options? #t) (argument-handler %default-argument-handler)) - "Parse the command-line arguments ARGS as well as arguments passed via the -'GUIX_BUILD_OPTIONS' environment variable according to OPTIONS (a list of -SRFI-37 options) and return the result, seeded by SEEDS. -Command-line options take precedence those passed via 'GUIX_BUILD_OPTIONS'. + "Parse the command-line arguments ARGS according to OPTIONS (a list of +SRFI-37 options) and return the result, seeded by SEEDS. When BUILD-OPTIONS? +is true, also pass arguments passed via the 'GUIX_BUILD_OPTIONS' environment +variable. Command-line options take precedence those passed via +'GUIX_BUILD_OPTIONS'. ARGUMENT-HANDLER is called for non-option arguments, like the 'operand-proc' parameter of 'args-fold'." @@ -85,7 +87,9 @@ parameter of 'args-fold'." (call-with-values (lambda () - (parse-options-from (environment-build-options) seeds)) + (if build-options? + (parse-options-from (environment-build-options) seeds) + (apply values seeds))) (lambda seeds ;; ARGS take precedence over what the environment variable specifies. (parse-options-from args seeds)))) |