Fallback created for git commands not standard handled by this module
This commit is contained in:
@@ -23,7 +23,23 @@ procedure and through direct procedures.
|
||||
```
|
||||
|
||||
`git` is an ordinary procedure. The first argument is the Git command symbol
|
||||
and the remaining arguments are passed to that command.
|
||||
and the remaining arguments are passed to that command. Registered commands use
|
||||
their git-cli wrapper and can provide structured Racket results or additional
|
||||
behavior. Any other command is passed directly to the installed Git executable
|
||||
and handled with git-cli's standard command result processing.
|
||||
|
||||
For example, commands that do not have a dedicated wrapper can still be used:
|
||||
|
||||
```racket
|
||||
(git 'blame "main.rkt")
|
||||
(git* clean -n)
|
||||
(git* worktree list)
|
||||
(git* archive --format=zip HEAD)
|
||||
```
|
||||
|
||||
A successful fallback command returns `#t` after displaying normal Git output.
|
||||
A failing fallback command raises the same standard git-cli error as an ordinary
|
||||
pass-through wrapper.
|
||||
|
||||
`git*` is the compact command-style syntax. Bare arguments are converted to
|
||||
strings, so `(git* remote get-url origin)` is equivalent to
|
||||
@@ -69,12 +85,16 @@ credentials, SSH keys, pull strategy, and other repository configuration.
|
||||
|
||||
## Commands
|
||||
|
||||
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`.
|
||||
The package registers wrappers for commands where git-cli adds useful behavior,
|
||||
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`. Other Git commands do not
|
||||
need a wrapper and are passed directly to Git.
|
||||
|
||||
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`.
|
||||
Most registered commands 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.
|
||||
|
||||
@@ -111,17 +131,41 @@ The non-interactive forms are:
|
||||
|
||||
```racket
|
||||
(git* config editor --list)
|
||||
(git* config editor --downloads)
|
||||
(git* config editor vscode)
|
||||
(git* config editor notepad++)
|
||||
(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.
|
||||
`--list` returns `(name description command current?)` items and `--downloads`
|
||||
returns official download pointers for optional editors. 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.
|
||||
|
||||
On Windows, Notepad++ is detected both on `PATH` and in the normal Program Files
|
||||
locations. It is started with `-multiInst -nosession`, so Git waits for the
|
||||
separate editor instance to close.
|
||||
|
||||
|
||||
`config mergetool` uses the same git-cli configuration pattern:
|
||||
|
||||
```racket
|
||||
(git* config mergetool)
|
||||
(git* config mergetool --list)
|
||||
(git* config mergetool --downloads)
|
||||
(git* config mergetool winmerge)
|
||||
(git* config mergetool auto)
|
||||
```
|
||||
|
||||
`--list` returns `(name description path current?)` items. A known tool name
|
||||
selects the detected tool, while another single value is stored as the Git
|
||||
mergetool name. `auto` clears the explicit git-cli choice and returns to
|
||||
automatic detection. The interactive form also offers download/install
|
||||
suggestions.
|
||||
|
||||
## Low-level Git execution
|
||||
|
||||
@@ -180,7 +224,7 @@ The editor can be inspected or configured explicitly:
|
||||
|
||||
The editor search first checks `PATH` and then well-known platform locations.
|
||||
On Windows this includes the normal per-user and Program Files locations for
|
||||
VS Code, with Notepad as fallback. On macOS the standard Visual Studio Code
|
||||
VS Code and Notepad++, with Notepad as fallback. On macOS the standard Visual Studio Code
|
||||
application bundle and TextEdit are recognized. On Linux common `/usr`,
|
||||
`/usr/local`, and Snap locations are checked for VS Code, Kate, Gedit, and Xed.
|
||||
|
||||
@@ -193,8 +237,11 @@ If no tool is found, Git is left to select its own default.
|
||||
|
||||
```racket
|
||||
(find-mergetool)
|
||||
(find-mergetools)
|
||||
(find-mergetool-path)
|
||||
(mergetool-downloads)
|
||||
(set-mergetool! "winmerge")
|
||||
(set-mergetool-auto!)
|
||||
(git* mergetool)
|
||||
(git* mergetool --tool=meld)
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user