Closed
Conversation
When executing `gh <cmd>`, if `<cmd>` is not a built-in command, this searches `~/.config/gh/gh-commands/*` and in PATH for executables named `gh-<cmd>` and runs the first one found. All arguments are forwarded to the executable and the following environment variables are set: - GITHUB_TOKEN for API calls; - GH_BASEREPO with the `OWNER/REPO` pair determined from git remotes. Additionally, the executable may provide shell completions by respecting the mode in which the 1st argument is `__complete` and by writing completion options as separate lines of output.
If multiple extensions provide a `gh-foo` command, invoking `gh foo`
will result in an error. The user will have to specify the extension
namespace explicitly, e.g.
$ gh @user1/foo
$ gh @user2/foo
Contributor
Author
|
Some example commands are now in https://github.com/mislav/gh-commands. Installing that repository per its README will grant you the Commands provided there:
|
|
hoop dit gaan goed en aie dankie. |
Contributor
|
this is ✨ but until we plan to merge and support I'm going to close this PR for book keeping purposes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When executing
gh <cmd>, if<cmd>is not a built-in command, this searches~/.config/gh/gh-commands/*and in PATH for executables namedgh-<cmd>and runs the first one found.All arguments are forwarded to the executable and the following environment variables are set:
<owner>/<repo>pair determined from git remotes.Example: command to identify the authenticated user
If saved as
gh-whoamisomewhere in the user's PATH, the command is invoked like so:All custom commands are listed in shell completions for the
ghcommand; e.g. typinggh who<Tab>will expand togh whoami.Additionally, the executable may provide its own shell completions by respecting when the 1st argument is
__completeand writing completion options as separate lines of output:TODO:
~/.config/gh/gh-commands/*__completegh __complete <cmd> ''returning extra results