added docs, changed to optional param

This commit is contained in:
John Clements 2011-02-15 14:57:51 -08:00
parent 1b843ea161
commit 9de3f25d15
3 changed files with 14 additions and 6 deletions

View File

@ -400,10 +400,13 @@ package specifier and the specified directory name.
@subsection[#:tag "unlink"]{@exec{unlink}} @subsection[#:tag "unlink"]{@exec{unlink}}
Usage: Usage:
@commandline{raco planet unlink <owner> <pkg> <maj> <min>} @commandline{raco planet unlink [ <option> ] <owner> <pkg> <maj> <min>}
Remove any development link (see @secref{devlinks}) associated with Remove any development link (see @secref{devlinks}) associated with
the given package. the given package.
@exec{<option>} can only be:
@itemize[@item{@exec{-q, --quiet}: don't signal an error on nonexistent links}]
@subsection[#:tag "fetch"]{@exec{fetch}} @subsection[#:tag "fetch"]{@exec{fetch}}
Usage: Usage:
@ -696,11 +699,15 @@ The @racket[pkg] argument must end with the string @racket[".plt"].
@defproc[(remove-hard-link [owner string?] @defproc[(remove-hard-link [owner string?]
[pkg (and/c string? #rx"[.]plt")] [pkg (and/c string? #rx"[.]plt")]
[maj natural-number/c] [maj natural-number/c]
[min natural-number/c]) [min natural-number/c]
[#:quiet? quiet? boolean? #false])
any]{ any]{
Removes any hard link that may be associated with the given package. Removes any hard link that may be associated with the given package.
The @racket[pkg] argument must end with the string @racket[".plt"]. The @racket[pkg] argument must end with the string @racket[".plt"].
The @racket[maj] and @racket[min] arguments must be integers. This
procedure signals an error if no such link exists, unless
@racket[#:quiet?] is @racket[#true].
} }
@defproc[(resolve-planet-path [spec quoted-planet-require-spec?]) @defproc[(resolve-planet-path [spec quoted-planet-require-spec?])

View File

@ -272,7 +272,7 @@ This command does not unpack or install the named .plt file."
[min (read-from-string minstr)]) [min (read-from-string minstr)])
(unless (and (integer? maj) (integer? min) (> maj 0) (>= min 0)) (unless (and (integer? maj) (integer? min) (> maj 0) (>= min 0))
(fail "Invalid major/minor version")) (fail "Invalid major/minor version"))
(remove-hard-link ownerstr pkgstr maj min quiet?))) (remove-hard-link ownerstr pkgstr maj min #:quiet? quiet?)))
(define (get-download-url ownerstr pkgstr majstr minstr) (define (get-download-url ownerstr pkgstr majstr minstr)
(let ([fps (params->full-pkg-spec ownerstr pkgstr majstr minstr)]) (let ([fps (params->full-pkg-spec ownerstr pkgstr majstr minstr)])

View File

@ -68,7 +68,8 @@
[add-hard-link [add-hard-link
(-> string? (and/c string? #rx"[.]plt") natural-number/c natural-number/c path? void?)] (-> string? (and/c string? #rx"[.]plt") natural-number/c natural-number/c path? void?)]
[remove-hard-link [remove-hard-link
(-> string? (and/c string? #rx"[.]plt") natural-number/c natural-number/c boolean? (->* (string? (and/c string? #rx"[.]plt") natural-number/c natural-number/c)
(#:quiet? boolean?)
void?)] void?)]
[remove-pkg [remove-pkg
(-> string? (and/c string? #rx"[.]plt") natural-number/c natural-number/c void?)] (-> string? (and/c string? #rx"[.]plt") natural-number/c natural-number/c void?)]
@ -767,9 +768,9 @@
(path->string path)))) (path->string path))))
(add-hard-link! pkg-name (list owner) maj min path)) (add-hard-link! pkg-name (list owner) maj min path))
;; remove-hard-link : string string num num boolean -> void ;; remove-hard-link : string string num num (#:quiet boolean) -> void
;; removes any development association from the given package spec ;; removes any development association from the given package spec
(define (remove-hard-link owner pkg-name maj min quiet?) (define (remove-hard-link owner pkg-name maj min #:quiet? [quiet? #false])
(define (matching-link? row) (define (matching-link? row)
(points-to? row pkg-name (list owner) maj min)) (points-to? row pkg-name (list owner) maj min))
(when (and (empty? (filter matching-link? (get-hard-link-table))) (when (and (empty? (filter matching-link? (get-hard-link-table)))