make collection xref for git help

This commit is contained in:
2026-08-11 22:53:28 +02:00
parent 7c6a338326
commit 069fdbf921
4 changed files with 10 additions and 8 deletions
+3 -2
View File
@@ -49,8 +49,9 @@ documentation cross-reference index:
``` ```
`raco setup git` builds and indexes the package documentation. The help command `raco setup git` builds and indexes the package documentation. The help command
uses the indexed path and anchor instead of assuming a particular documentation builds a fresh cross-reference view for each request, so documentation generated
directory. during the current DrRacket session is visible immediately. It uses the indexed
path and anchor instead of assuming a particular documentation directory.
## HTTPS credentials ## HTTPS credentials
+1 -1
View File
@@ -2,7 +2,7 @@
(define collection "git") (define collection "git")
(define pkg-desc "Command-line-like Git operations for Racket, implemented with libgit2") (define pkg-desc "Command-line-like Git operations for Racket, implemented with libgit2")
(define version "0.2.15") (define version "0.2.16")
(define pkg-authors '("Hans Dijkema")) (define pkg-authors '("Hans Dijkema"))
(define license 'MIT) (define license 'MIT)
+4 -3
View File
@@ -123,9 +123,10 @@
(lambda () (lambda ()
(error 'git-help "unknown help topic: ~a" topic))) (error 'git-help "unknown help topic: ~a" topic)))
'git)) 'git))
;; Use Racket's installed-documentation cross-reference database instead of ;; Build a fresh installed-documentation cross-reference database instead of
;; guessing where raco setup placed this package's generated HTML. ;; using load-collections-xref's process-local cache. This makes help notice
(define xref (load-collections-xref)) ;; documentation generated by raco setup during the current DrRacket session.
(define xref (make-collections-xref))
(define tag (define tag
(xref-binding->definition-tag xref (list 'git binding) #f)) (xref-binding->definition-tag xref (list 'git binding) #f))
(unless tag (unless tag
+2 -2
View File
@@ -48,14 +48,14 @@ Calls @racket[git], displays its result in a compact human-readable form, and re
(git 'help 'restore) (git 'help 'restore)
] ]
Help uses Racket's installed-documentation cross-reference database. It resolves the documented binding for the requested command through @racketmodname[setup/xref] and @racketmodname[scribble/xref], then opens the path and anchor recorded by @exec{raco setup}. No documentation directory is guessed or constructed by @racketmodname[git]. If the binding is not indexed, @racket[git-help] reports that @exec{raco setup git} should be run. Help uses Racket's installed-documentation cross-reference database. It builds a fresh collection xref for each help request, resolves the documented binding through @racketmodname[setup/xref] and @racketmodname[scribble/xref], then opens the path and anchor recorded by @exec{raco setup}. This means a newly run @exec{raco setup git} is visible immediately in the same DrRacket session. No documentation directory is guessed or constructed by @racketmodname[git]. If the binding is not indexed, @racket[git-help] reports that @exec{raco setup git} should be run.
@section[#:tag "version"]{Version} @section[#:tag "version"]{Version}
@defproc[(git-version) string?]{Returns the package version from @tt{info.rkt}. The command form is @racket[(git 'version)]. The version is not duplicated in @tt{main.rkt}; @tt{info.rkt} is the single source of truth.} @defproc[(git-version) string?]{Returns the package version from @tt{info.rkt}. The command form is @racket[(git 'version)]. The version is not duplicated in @tt{main.rkt}; @tt{info.rkt} is the single source of truth.}
@racketblock[ @racketblock[
(git 'version) ; => "0.2.15" (git 'version) ; => "0.2.16"
] ]
@section[#:tag "repository"]{Repository} @section[#:tag "repository"]{Repository}