Editor configuration added.
This commit is contained in:
@@ -7,6 +7,7 @@ procedure and through direct procedures.
|
||||
```racket
|
||||
(require git-cli)
|
||||
|
||||
(git 'init)
|
||||
(git 'status)
|
||||
(git 'log '-l '-5)
|
||||
(git 'fetch '--prune)
|
||||
@@ -31,6 +32,7 @@ must come from a Racket expression. `gt` remains available as a compatibility
|
||||
alias for `git*`.
|
||||
|
||||
```racket
|
||||
(git* init)
|
||||
(git* remote -v)
|
||||
(git* switch main)
|
||||
(git* restore --staged main.rkt)
|
||||
@@ -67,11 +69,11 @@ credentials, SSH keys, pull strategy, and other repository configuration.
|
||||
|
||||
## Commands
|
||||
|
||||
The package currently registers commands including `status`, `add`, `commit`,
|
||||
The package currently registers commands including `init`, `status`, `add`, `commit`,
|
||||
`push`, `pull`, `fetch`, `config`, `branch`, `remote`, `stash`, `restore`, `reset`, `revert`, `rebase`, `merge`, `cherry-pick`, `mergetool`, `switch`, `clone`, `tag`, `log`,
|
||||
`rev-list`, `diff`, `show`, `grep`, `help`, `version`, and `new-version`.
|
||||
|
||||
Most are also exported as direct procedures such as `git-status`, `git-add`,
|
||||
Most are also exported as direct procedures such as `git-init`, `git-status`, `git-add`,
|
||||
`git-fetch`, `git-config`, `git-switch`, `git-tag`, `git-log`, `git-diff`, and `git-show`.
|
||||
|
||||
See the Scribble documentation for command-specific behavior and return values.
|
||||
@@ -96,6 +98,31 @@ See the Scribble documentation for command-specific behavior and return values.
|
||||
returns all values for one key. `get key` returns one string or `#f` when the
|
||||
key is absent. `set!` returns `#t` after a successful write.
|
||||
|
||||
|
||||
`config editor` is a git-cli configuration command rather than a Git
|
||||
configuration key. With no additional arguments it presents an interactive
|
||||
list of discovered GUI editors:
|
||||
|
||||
```racket
|
||||
(git* config editor)
|
||||
```
|
||||
|
||||
The non-interactive forms are:
|
||||
|
||||
```racket
|
||||
(git* config editor --list)
|
||||
(git* config editor vscode)
|
||||
(git* config editor auto)
|
||||
|
||||
(git 'config 'editor "C:\\Program Files\\MyEditor\\editor.exe --wait")
|
||||
```
|
||||
|
||||
`--list` returns `(name description command current?)` items. A known editor
|
||||
name selects the matching detected editor. `auto` clears the explicit git-cli
|
||||
editor choice and returns to automatic detection. Any other single value is
|
||||
stored as the editor command. Changing the editor immediately updates
|
||||
`GIT_EDITOR` and `GIT_SEQUENCE_EDITOR` for subsequent Git commands.
|
||||
|
||||
## Low-level Git execution
|
||||
|
||||
`run-git` can be used when direct access to Git's stdin/stdout protocol is
|
||||
@@ -137,15 +164,18 @@ A custom handler can still be installed through
|
||||
|
||||
## GUI editor and merge tool
|
||||
|
||||
git-cli looks for a GUI editor and passes it to Git through `GIT_EDITOR` and
|
||||
`GIT_SEQUENCE_EDITOR` in the environment of the Git subprocess only. It does
|
||||
not change the user's global Git configuration.
|
||||
When git-cli is loaded, it configures the current Racket process once for the
|
||||
Git commands it starts. `GIT_TERMINAL_PROMPT` is set to `0`. When a GUI editor
|
||||
is found, `GIT_EDITOR` and `GIT_SEQUENCE_EDITOR` are set to that editor command.
|
||||
`run-git` itself no longer copies or rewrites the process environment.
|
||||
|
||||
The editor can be inspected or configured explicitly:
|
||||
|
||||
```racket
|
||||
(find-editor)
|
||||
(find-editors)
|
||||
(set-editor! "code --wait")
|
||||
(set-editor-auto!)
|
||||
```
|
||||
|
||||
The editor search first checks `PATH` and then well-known platform locations.
|
||||
@@ -158,10 +188,8 @@ application bundle and TextEdit are recognized. On Linux common `/usr`,
|
||||
specified explicitly, git-cli prefers a configured or well-known graphical
|
||||
tool such as WinMerge, Meld, KDiff3, VS Code, TortoiseMerge, or opendiff.
|
||||
The finder checks `PATH` first and then common platform installation locations.
|
||||
When a merge tool is found outside `PATH`, git-cli adds that executable's
|
||||
directory to the environment of the Git subprocess, so Git's own mergetool
|
||||
integration can still find it. If no tool is found, Git is left to select its
|
||||
own default.
|
||||
`find-mergetool-path` can be used to inspect the executable that was found.
|
||||
If no tool is found, Git is left to select its own default.
|
||||
|
||||
```racket
|
||||
(find-mergetool)
|
||||
|
||||
Reference in New Issue
Block a user