Revert "Diverse commando's toegevoegd. Ik weet nog niet of ik ze allemaal ga houden"
This reverts commit 003f3713f0.
This commit is contained in:
@@ -1,54 +1,49 @@
|
||||
# git-cli
|
||||
# git
|
||||
|
||||
A small command-line-like Git module for Racket. It invokes the installed
|
||||
`git` executable and exposes commands both through `git` and through direct
|
||||
procedures.
|
||||
A small command-line-like Git module for Racket, implemented directly on top of the `libgit2` package.
|
||||
|
||||
```racket
|
||||
(require git-cli)
|
||||
(require git)
|
||||
|
||||
(git 'help)
|
||||
(git 'help 'grep)
|
||||
(git 'status)
|
||||
(git 'fetch '--prune)
|
||||
(git 'switch "main")
|
||||
(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 'switch "main")
|
||||
|
||||
(git-status)
|
||||
(git-current-branch)
|
||||
(git-branches)
|
||||
(git-remotes)
|
||||
;; Display-oriented variant:
|
||||
(dgit 'status)
|
||||
```
|
||||
|
||||
`git-status` returns the index and working-tree status separately:
|
||||
`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 '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)`.
|
||||
|
||||
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.
|
||||
|
||||
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`.
|
||||
|
||||
|
||||
## Help
|
||||
|
||||
Open the locally installed Scribble documentation through Racket's
|
||||
documentation cross-reference index:
|
||||
|
||||
```racket
|
||||
'((modified unchanged "staged.rkt")
|
||||
(unchanged modified "working-tree.rkt")
|
||||
(untracked untracked "new.rkt"))
|
||||
(git 'help)
|
||||
(git 'help 'grep)
|
||||
(git 'help 'restore)
|
||||
```
|
||||
|
||||
The module also provides a few direct workflows:
|
||||
|
||||
```racket
|
||||
(git-save "Implement status parser" "main.rkt" "scribblings/git.scrbl")
|
||||
(git-save-all "Finish release")
|
||||
(git-start-branch "feature")
|
||||
(git-sync)
|
||||
(git-release 'patch)
|
||||
```
|
||||
|
||||
`git-sync` requires a clean working tree and performs pull followed by push.
|
||||
`git-release` increments `info.rkt`, commits it, and creates a tag; it does not
|
||||
push automatically.
|
||||
|
||||
Git is searched on `PATH`. If it cannot be found, `git-cli` asks for the path
|
||||
to `git` or `git.exe` and stores it in its simple-ini configuration.
|
||||
|
||||
```racket
|
||||
(set-git-config! 'display-output #t)
|
||||
(set-git-config! 'display-command #f)
|
||||
(set-git-config! 'tag-prefix "v")
|
||||
```
|
||||
|
||||
Remote names, upstream branches, pull strategy, credentials and SSH keys remain
|
||||
normal Git configuration.
|
||||
|
||||
Reference in New Issue
Block a user