Files
fish-shell/share/completions/tig.fish
Fabian Boehm 329cd7d429 Make functions, completions and tests resilient to running on an embed-data fish
In case a completion needs a function from another script, run
`complete -C"foo "` to load it, so the full autoloading logic is used.

Otherwise these things break if the path is off. E.g. cargo's version
will fail if you override the cargo completion in
~/.config/fish/completions without also overriding the rustup
completions.

In other cases, fix for empty $__fish_data_dir, which will be coming in the next commit
2025-04-11 17:29:22 +02:00

28 lines
1.9 KiB
Fish

# tig - text-mode interface for Git
functions -q __fish_git || complete -C"git " &>/dev/null
set -l subcommands log show reflog blame grep refs statsh status
complete -c tig -n "not contains -- -- (commandline -xpc) && not __fish_seen_subcommand_from $subcommands" -xa 'show\t"Open diff view using the given git-show(1) options"
blame\t"Annotate the given file, takes git-blame(1) options"
status\t"Start up in status view"
log\t"Start up in log view view, displaying git-log(1) output"
reflog\t"Start up in reflog view"
refs\t"Start up in refs view"
stash\t"Start up in stash view"
grep\t"Open the grep view. Supports the same options as git-grep(1)"
'
complete -c tig -n 'not contains -- -- (commandline -xpc)' -l stdin -d 'Read git commit IDs from stdin'
complete -c tig -n 'not contains -- -- (commandline -xpc)' -l pretty=raw -d 'Read git log output from stdin'
complete -c tig -n 'not contains -- -- (commandline -xpc)' -s C -r -d 'Run as if Tig was started in this directory'
complete -c tig -n 'not contains -- -- (commandline -xpc)' -s v -l version -d 'Show version and exit'
complete -c tig -n 'not contains -- -- (commandline -xpc)' -s h -l help -d 'Show help message and exit'
complete -c tig -n 'not contains -- -- (commandline -xpc) && __fish_seen_subcommand_from show' -xa '(set -l t (commandline -ct); complete -C"git show $t")'
complete -c tig -n 'not contains -- -- (commandline -xpc) && __fish_seen_subcommand_from blame' -xa '(set -l t (commandline -ct); complete -C"git blame $t")'
complete -c tig -n 'not contains -- -- (commandline -xpc) && __fish_seen_subcommand_from log' -xa '(set -l t (commandline -ct); complete -C"git log $t")'
complete -c tig -n 'not contains -- -- (commandline -xpc) && __fish_seen_subcommand_from grep' -xa '(set -l t (commandline -ct); complete -C"git grep $t")'
complete -c tig -f -n 'not contains -- -- (commandline -xpc)' -a '(__fish_git_ranges)'
complete -c tig -n 'contains -- -- (commandline -xpc)' -F