82 lines
3.0 KiB
Racket
82 lines
3.0 KiB
Racket
#lang scribble/manual
|
|
|
|
@(require (for-label racket/base
|
|
git-cli))
|
|
|
|
@title[#:tag "top"]{git-cli}
|
|
@author{Hans Dijkema}
|
|
|
|
@defmodule[git-cli]
|
|
|
|
The @racketmodname[git-cli] module provides a command-line-like Git interface
|
|
implemented by invoking the @tt{git} executable. Commands never read from
|
|
standard input.
|
|
|
|
@defform[(git command argument ...)]{
|
|
Runs a supported Git @racket[command]. The arguments are passed to the Git
|
|
command. Supported commands include @racket['status], @racket['add],
|
|
@racket['commit], @racket['push], @racket['pull], @racket['branch],
|
|
@racket['clone], @racket['log], @racket['rev-list], @racket['diff],
|
|
@racket['grep], @racket['help], @racket['version], and
|
|
@racket['new-version].
|
|
}
|
|
|
|
@defproc[(git-status [argument any/c] ...) list?]{
|
|
Runs @tt{git status --porcelain} with the supplied arguments.
|
|
|
|
Each result item has the form
|
|
@racket[(index-status worktree-status file)]. The index status describes the
|
|
change staged for the next commit. The worktree status describes the change in
|
|
the working tree relative to the index.
|
|
|
|
Both statuses are one of @racket['unchanged], @racket['modified],
|
|
@racket['type-changed], @racket['added], @racket['deleted], @racket['renamed],
|
|
@racket['copied], @racket['unmerged], @racket['untracked], or
|
|
@racket['ignored]. For an untracked file, Git reports @tt{??}, so both statuses
|
|
are @racket['untracked].
|
|
|
|
@racketblock[
|
|
((modified unchanged "staged.rkt")
|
|
(unchanged modified "working-tree.rkt")
|
|
(modified modified "both.rkt")
|
|
(renamed unchanged "old.rkt -> new.rkt")
|
|
(untracked untracked "new.rkt"))
|
|
]}
|
|
|
|
@defproc[(git-add [argument any/c] ...) boolean?]{
|
|
Adds file contents to the index. Returns @racket[#t] when Git exits with status
|
|
zero; otherwise an exception is raised.
|
|
}
|
|
|
|
@defproc[(git-commit [argument any/c] ...) boolean?]{
|
|
Creates a commit. When @tt{-m} is omitted, a commit message is requested before
|
|
Git is started. A repository with nothing to commit returns @racket[#t]. Other
|
|
non-zero exit statuses, including a rejected commit hook, raise an exception.
|
|
}
|
|
|
|
@defproc[(git-push [argument any/c] ...) boolean?]{
|
|
Pushes changes using @tt{--porcelain}. Returns @racket[#t] when Git exits with
|
|
status zero; otherwise an exception is raised.
|
|
}
|
|
|
|
@defproc[(git-pull [argument any/c] ...) boolean?]{
|
|
Fetches and integrates changes. Normal progress written by Git to standard
|
|
error is treated as output when Git exits successfully.
|
|
}
|
|
|
|
@defproc[(git-log [argument any/c] ...) boolean?]{
|
|
Displays Git log output and returns @racket[#t] when Git exits successfully.
|
|
}
|
|
|
|
@defproc[(git-grep [argument any/c] ...) list?]{
|
|
Searches tracked files. Each result contains the file, optional line number,
|
|
optional match count, and matched text. Exit status one means that no matches
|
|
were found and returns an empty list.
|
|
}
|
|
|
|
@defproc[(git-new-version [kind symbol?]) list?]{
|
|
Updates the version in @filepath{info.rkt}. The kind is @racket['major],
|
|
@racket['minor], or @racket['patch], with @racket['maj] and @racket['min] as
|
|
abbreviations. The result is the new version as a list of three integers.
|
|
}
|