Add -A/-R switches to 'doom env'
Two new convenience switches for generating envvar files: doom env -A x doom env -R x Is equivalent to doom env -a x -r . doom env -r x -a .
This commit is contained in:
parent
68507e1eac
commit
7dab38deea
1 changed files with 11 additions and 5 deletions
|
@ -1,8 +1,10 @@
|
|||
;;; core/cli/env.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defcli! env
|
||||
((allow ["-a" "--allow" regexp] "An envvar whitelist regexp")
|
||||
(reject ["-r" "--reject" regexp] "An envvar blacklist regexp")
|
||||
((allow ["-a" "--allow" regexp] "An additive envvar whitelist regexp")
|
||||
(reject ["-r" "--reject" regexp] "An additive envvar blacklist regexp")
|
||||
(allow-only ["-A" regexp] "Blacklist everything but REGEXP")
|
||||
(reject-only ["-R" regexp] "Whitelist everything but REGEXP")
|
||||
(clear-p ["-c" "--clear"] "Clear and delete your envvar file")
|
||||
(outputfile ["-o" path]
|
||||
"Generate the envvar file at PATH. Envvar files that aren't in
|
||||
|
@ -42,7 +44,11 @@ Why this over exec-path-from-shell?
|
|||
(let ((env-file (expand-file-name (or outputfile doom-env-file))))
|
||||
(if (null clear-p)
|
||||
(doom-cli-reload-env-file
|
||||
'force env-file (list allow) (list reject))
|
||||
'force env-file
|
||||
(append (if reject-only (list "."))
|
||||
(delq nil (list allow allow-only)))
|
||||
(append (if allow-only (list "."))
|
||||
(delq nil (list reject reject-only))))
|
||||
(unless (file-exists-p env-file)
|
||||
(user-error! "%S does not exist to be cleared"
|
||||
(path env-file)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue