fix(cli): validation for regexp arguments

string-match-p throws an error if given an invalid regexp, which is what
we *should* be testing for, not its return value (which should be
ignored), but this wasn't the case before this commit.

Fix: #6534
This commit is contained in:
Henrik Lissner 2022-07-05 12:41:43 +02:00
parent acae9f9acb
commit cd8fb0059d
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -59,7 +59,7 @@ See argument types in `doom-cli-argument-types', and `defcli!' for usage.")
:zshcomp "_files") :zshcomp "_files")
(path :read expand-file-name :zshcomp "_files") (path :read expand-file-name :zshcomp "_files")
(form :read read) (form :read read)
(regexp :test ,(doom-rpartial #'string-match-p "")) (regexp :test ,(lambda (str) (always (string-match-p str ""))))
(int :test "^[0-9]+$" (int :test "^[0-9]+$"
:read string-to-number :read string-to-number
:error "Not an integer") :error "Not an integer")