Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/speedyleion/gh-difftool
A difftool implementation for use with gh cli
https://github.com/speedyleion/gh-difftool
cli gh-extension rust
Last synced: 2 months ago
JSON representation
A difftool implementation for use with gh cli
- Host: GitHub
- URL: https://github.com/speedyleion/gh-difftool
- Owner: speedyleion
- License: bsl-1.0
- Created: 2022-10-07T01:45:16.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-14T20:28:27.000Z (9 months ago)
- Last Synced: 2024-04-19T19:04:26.786Z (9 months ago)
- Topics: cli, gh-extension, rust
- Language: Rust
- Homepage:
- Size: 337 KB
- Stars: 8
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-gh-cli-extensions - **difftool** - Launches a difftool to show the differences of a pull request. (Tool)
README
# gh-difftool
A difftool extension to the GitHub CLI, [gh](https://cli.github.com/).
Launches a difftool to show the differences of a pull request. The files
will be created in a temporary directory with the base branch version of the
files prefixed with `base_`.```shell
Usage: gh-difftool [OPTIONS] [PR] [-- ...]Arguments:
[PR]
The pull request to diff
When omitted the pull request associated with the current branch will be used
A pull request can be supplied as argument in any of the following formats:
- by number, e.g. "123"
- by URL, e.g. "https://github.com/OWNER/REPO/pull/123"[FILES]...
Specific files to diff.
When not provided all of the files that changed in the pull request will be diffedOptions:
-t, --tool
The tool to use for diffing
[env: GH_DIFFTOOL=]-R, --repo
The GitHub repo to diff, defaults to the GitHub remote of the current git repo--name-only
Show only the names of files that changed in a pull request--rotate-to
Start showing the diff for the given file, the files before it will move to end.
Applied before `--skip-to`. This behavior deviates from `git-difftool` which
seems to ignore rotation when `--skip-to` is present.--skip-to
Start showing the diff for the given file, skipping all the files before it-h, --help
Print help information (use `-h` for a summary)-V, --version
Print version information
```With no args, the tool will try to diff the current branch's pull request.
When provided a pull request number or URL will diff that pull request. When
provided a repo (requires a pull request number), will diff that repo's pull
request.For instance one can do the following from any cloned GitHub repo
```shell
gh difftool --repo speedyleion/gh-difftool 10
```## Installation
This can be installed like any other GitHub CLI extension,
```shell
gh extension install speedyleion/gh-difftool
```Current installs support:
- x86_64 Linux
- arm64 Android
- x86_64 Mac
- arm64 Mac
- x86_64 Windows## Configuration
By default, the tool to use will be derived from the current git configuration
. The `diff.tool` git configuration
option will be used to determine the tool. Similar to git, if `diff.tool` is
not set then `merge.tool` will be used. Unlike git, if neither option is set
`gh-difftool` will report an error.Alternatively one can specify a tool to use via the command line argument `-t,
--tool` or by the environment variable `GH_DIFFTOOL`.There are a handful of known difftools available in `gh-difftool`, (bc, bc3,
bc4, meld, gvimdiff). These known tools assume that the executable is available
in the `PATH`.> Note: `gh-difftool` does *not* support the `difftool.trustExitCode` git
> config option. Exit codes are not trusted.### Tool Path
When the difftool is not in the `PATH`, it can be specified via
the `difftool..path` git config option.```ini
[difftool.sometool]
path = /path/to/some/difftool
```### Tool Command
If your difftool of choice is not supported you can explicitly
use the `difftool..cmd` option.```ini
[difftool.sometool]
cmd = /path/to/some/unsupported/difftool --extra-arg=foo $LOCAL $REMOTE
```The `$LOCAL` and `$REMOTE` variables will be replaced with the paths to the
local and remote temporary files.Unlike the standard git difftool, the
[`difftool..cmd`](https://git-scm.com/docs/git-difftool#Documentation/git-difftool.txt-difftoollttoolgtcmd)
used with `gh-difftool` will *not* be run in a shell.This means:
- Only the `$LOCAL` and `$REMOTE` variables will be replaced.
- the `$LOCAL` and `$REMOTE` variables need to be space separated.
Use `--local $LOCAL`, not `--local=$LOCAL`.## Requires
- The GitHub CLI, [gh](https://cli.github.com/)
- The [patch](https://www.man7.org/linux/man-pages/man1/patch.1.html) utility