mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
environment: Move iteration outside of 'for-each-search-path'.
* guix/search-paths.scm (search-path-definition): New procedure. * guix/scripts/environment.scm (for-each-search-path): Rename to... (evaluate-input-search-paths): ... this. Remove 'proc' and 'pure?' parameters, and return directly the list of search-path/value pairs. (create-environment): Use 'for-each' and 'evaluate-input-search-paths' instead of 'for-each-search-path'. (show-search-paths): Use 'for-each', 'search-path-definition', and 'evaluate-search-paths' instead of 'for-each-search-path'.
This commit is contained in:
parent
b9ea6c6bf4
commit
8e3a3bc290
2 changed files with 32 additions and 19 deletions
|
@ -36,7 +36,8 @@
|
|||
search-path-specification->sexp
|
||||
sexp->search-path-specification
|
||||
evaluate-search-paths
|
||||
environment-variable-definition))
|
||||
environment-variable-definition
|
||||
search-path-definition))
|
||||
|
||||
;;; Commentary:
|
||||
;;;
|
||||
|
@ -160,7 +161,7 @@ report only settings not already effective."
|
|||
#:key
|
||||
(kind 'exact)
|
||||
(separator ":"))
|
||||
"Return a the definition of VARIABLE to VALUE in Bash syntax:
|
||||
"Return a the definition of VARIABLE to VALUE in Bash syntax.
|
||||
|
||||
KIND can be either 'exact (return the definition of VARIABLE=VALUE),
|
||||
'prefix (return the definition where VALUE is added as a prefix to VARIABLE's
|
||||
|
@ -178,4 +179,14 @@ prefix/suffix."
|
|||
(format #f "export ~a=\"$~a${~a:+~a}~a\""
|
||||
variable variable variable separator value))))
|
||||
|
||||
(define* (search-path-definition search-path value
|
||||
#:key (kind 'exact))
|
||||
"Similar to 'environment-variable-definition', but applied to a
|
||||
<search-path-specification>."
|
||||
(match search-path
|
||||
(($ <search-path-specification> variable _ separator)
|
||||
(environment-variable-definition variable value
|
||||
#:kind kind
|
||||
#:separator separator))))
|
||||
|
||||
;;; search-paths.scm ends here
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue