make raco setup call raise-user-error instead of error when reporting malformed command-line collection paths
This commit is contained in:
parent
2fe1c3b80d
commit
70b0eb8ac9
|
@ -80,7 +80,7 @@
|
||||||
[("--doc-pdf") dir "Write doc PDF to <dir>"
|
[("--doc-pdf") dir "Write doc PDF to <dir>"
|
||||||
(add-flags `((doc-pdf-dest ,dir)))]
|
(add-flags `((doc-pdf-dest ,dir)))]
|
||||||
[("-l") => (lambda (flag . collections)
|
[("-l") => (lambda (flag . collections)
|
||||||
(check-collections collections)
|
(check-collections short-name collections)
|
||||||
(cons 'collections (map list collections)))
|
(cons 'collections (map list collections)))
|
||||||
'("Setup specific <collection>s only" "collection")]
|
'("Setup specific <collection>s only" "collection")]
|
||||||
[("-A") => (λ (flag . archives)
|
[("-A") => (λ (flag . archives)
|
||||||
|
@ -103,7 +103,7 @@
|
||||||
'())])
|
'())])
|
||||||
(cond
|
(cond
|
||||||
[raco?
|
[raco?
|
||||||
(check-collections rest)
|
(check-collections short-name rest)
|
||||||
(values (append pre-collections (map list rest))
|
(values (append pre-collections (map list rest))
|
||||||
pre-archives)]
|
pre-archives)]
|
||||||
[else
|
[else
|
||||||
|
@ -119,15 +119,16 @@
|
||||||
|
|
||||||
(values short-name x-flags x-specific-collections x-specific-planet-packages x-archives))
|
(values short-name x-flags x-specific-collections x-specific-planet-packages x-archives))
|
||||||
|
|
||||||
(define (check-collections collections)
|
(define (check-collections name collections)
|
||||||
(for ((v (in-list collections)))
|
(for ((v (in-list collections)))
|
||||||
;; A normal-form collection path matches a symbolic module path;
|
;; A normal-form collection path matches a symbolic module path;
|
||||||
;; this is a bit of a hack, but it's not entirely a coincidence:
|
;; this is a bit of a hack, but it's not entirely a coincidence:
|
||||||
(unless (module-path? (string->symbol v))
|
(unless (module-path? (string->symbol v))
|
||||||
(error (format "bad collection path~a: ~a"
|
(raise-user-error (string->symbol name)
|
||||||
|
"bad collection path~a: ~a"
|
||||||
(cond [(regexp-match? #rx"/$" v)
|
(cond [(regexp-match? #rx"/$" v)
|
||||||
" (trailing slash not allowed)"]
|
" (trailing slash not allowed)"]
|
||||||
[(regexp-match? #rx"\\\\" v)
|
[(regexp-match? #rx"\\\\" v)
|
||||||
" (backslash not allowed)"]
|
" (backslash not allowed)"]
|
||||||
[else ""])
|
[else ""])
|
||||||
v)))))
|
v))))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user