Documentation.
This commit is contained in:
@@ -1,49 +1,50 @@
|
||||
# git
|
||||
# git-cli
|
||||
|
||||
A small command-line-like Git module for Racket, implemented directly on top of the `libgit2` package.
|
||||
A small command-line-like Git interface for Racket. The package invokes the
|
||||
installed `git` executable and exposes commands both through the generic `git`
|
||||
procedure and through direct procedures.
|
||||
|
||||
```racket
|
||||
(require git)
|
||||
(require git-cli)
|
||||
|
||||
(git 'help)
|
||||
(git 'help 'grep)
|
||||
(git 'status)
|
||||
(git 'diff)
|
||||
(git 'diff '--cached)
|
||||
(git 'add "main.rkt" "info.rkt")
|
||||
(git 'restore '--staged "scratch.rkt")
|
||||
(git 'reset 'HEAD "--" "main.rkt")
|
||||
(git 'grep '-i '-n "todo")
|
||||
(git 'commit "Implement raco support")
|
||||
(git 'tag "v0.2")
|
||||
(git 'branch-current)
|
||||
(git 'log '-l '-5)
|
||||
(git 'fetch '--prune)
|
||||
(git 'switch "main")
|
||||
(git 'tag "v0.3.16")
|
||||
(git 'diff)
|
||||
(git 'show 'HEAD)
|
||||
|
||||
;; Display-oriented variant:
|
||||
(dgit 'status)
|
||||
(git-status)
|
||||
(git-fetch '--prune)
|
||||
(git-switch "main")
|
||||
(git-tag "v0.3.16")
|
||||
```
|
||||
|
||||
`git` is an ordinary procedure; command names are symbols. `dgit` performs the
|
||||
same operation, displays a compact human-readable result, and returns that result.
|
||||
`git` is an ordinary procedure. The first argument is the Git command symbol
|
||||
and the remaining arguments are passed to that command.
|
||||
|
||||
`(git 'help)` opens the locally installed Scribble documentation. A command can
|
||||
be supplied to jump directly to its section, for example `(git 'help 'restore)`
|
||||
or `(git 'help 'grep)`.
|
||||
Several commands provide Racket-oriented output in addition to the normal Git
|
||||
behavior:
|
||||
|
||||
For `grep`, the natural `(git 'grep '-i "pattern")` spelling is supported even
|
||||
though Racket's reader represents `-i` as the complex number `0-1i`; in grep
|
||||
option position that value is interpreted as Git's `-i` flag.
|
||||
- `git-status` uses Git's porcelain status and returns structured status items.
|
||||
- `git-log -l` / `git-log --list` returns `(commit subject)` items.
|
||||
- `git-diff` renders HTML by default; `--output=-` selects stdout and
|
||||
`--output=string` returns a string.
|
||||
- `git-show` renders a commit and its diff as HTML by default. `-l` /
|
||||
`--list` provides structured variants for `--stat`, `--name-only`, and
|
||||
`--name-status`.
|
||||
|
||||
The same operations are available as normal procedures such as `git-status`, `git-add`, `git-commit`, `git-tag`, `git-current-branch`, `git-switch`, and `git-checkout`.
|
||||
Git is searched on `PATH`. Git itself remains responsible for remotes,
|
||||
credentials, SSH keys, pull strategy, and other repository configuration.
|
||||
|
||||
## Commands
|
||||
|
||||
## Help
|
||||
The package currently registers commands including `status`, `add`, `commit`,
|
||||
`push`, `pull`, `fetch`, `branch`, `switch`, `clone`, `tag`, `log`,
|
||||
`rev-list`, `diff`, `show`, `grep`, `help`, `version`, and `new-version`.
|
||||
|
||||
Open the locally installed Scribble documentation through Racket's
|
||||
documentation cross-reference index:
|
||||
Most are also exported as direct procedures such as `git-status`, `git-add`,
|
||||
`git-fetch`, `git-switch`, `git-tag`, `git-log`, `git-diff`, and `git-show`.
|
||||
|
||||
```racket
|
||||
(git 'help)
|
||||
(git 'help 'grep)
|
||||
(git 'help 'restore)
|
||||
```
|
||||
See the Scribble documentation for command-specific behavior and return values.
|
||||
|
||||
Reference in New Issue
Block a user