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>"
|
||||
(add-flags `((doc-pdf-dest ,dir)))]
|
||||
[("-l") => (lambda (flag . collections)
|
||||
(check-collections collections)
|
||||
(check-collections short-name collections)
|
||||
(cons 'collections (map list collections)))
|
||||
'("Setup specific <collection>s only" "collection")]
|
||||
[("-A") => (λ (flag . archives)
|
||||
|
@ -103,7 +103,7 @@
|
|||
'())])
|
||||
(cond
|
||||
[raco?
|
||||
(check-collections rest)
|
||||
(check-collections short-name rest)
|
||||
(values (append pre-collections (map list rest))
|
||||
pre-archives)]
|
||||
[else
|
||||
|
@ -119,15 +119,16 @@
|
|||
|
||||
(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)))
|
||||
;; A normal-form collection path matches a symbolic module path;
|
||||
;; this is a bit of a hack, but it's not entirely a coincidence:
|
||||
(unless (module-path? (string->symbol v))
|
||||
(error (format "bad collection path~a: ~a"
|
||||
(cond [(regexp-match? #rx"/$" v)
|
||||
" (trailing slash not allowed)"]
|
||||
[(regexp-match? #rx"\\\\" v)
|
||||
" (backslash not allowed)"]
|
||||
[else ""])
|
||||
v)))))
|
||||
(raise-user-error (string->symbol name)
|
||||
"bad collection path~a: ~a"
|
||||
(cond [(regexp-match? #rx"/$" v)
|
||||
" (trailing slash not allowed)"]
|
||||
[(regexp-match? #rx"\\\\" v)
|
||||
" (backslash not allowed)"]
|
||||
[else ""])
|
||||
v))))
|
||||
|
|
Loading…
Reference in New Issue
Block a user