Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
name: Git
version: "1.0.0"
author: "Jane Doe <jane@doe.com>"
about: Git Command Completion
arguments:
- name: branch
short: br
long: branch
# optional_arguments are completed by the engine based on the input text.
# These fields are static. For example, when you type `git branch -<TAB>`,
# the engine will look in the optional_arguments and provide all of them.
# When you type `git branch --co<TAB>`, only the optional_arguments that
# start with `--co` will be displayed.
optional_arguments:
- "--color"
- "--no-color"
- "-v"
# When a completion item requires dynamic processing, a chain of scripts
# can be used to return the list of items that will be used in completion.
# Each item is a OS specific or OS agnostic command that gets run, and its
# output gets fed to the next command in chain. The resulting string is
# used to complete.
# For example, the following sample commands will return a list of
# branches that the engine uses to complete the `git branch ma<TAB>`
# command.
custom_completers:
- command: git
args:
- "branch"
- "-a"
- command: sed
os: macos
args:
- "s/origin\///"
- command: sed
os: macos
args:
- "s/\*/\ /"
- command: ForEach-Object
os: windows
args:
- '{ $_.Replace("origin/","").Replace("*", " ") }'
- name: stash
optional_arguments:
- positional_argument: "push"
options:
- "-m"
# When positional_arguments is provided, they take priorty. If this list
# doesn't provide any completed item, then custom_completers is used.
positional_arguments:
- "push"
- "pop"
# Example
# complete --command-name git --arguments "branch dev" --cursor-position 10
# complete --command-name git --arguments "checkout dev" --cursor-position 12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment