| 1 | #compdef delta |
| 2 | |
| 3 | autoload -U is-at-least |
| 4 | |
| 5 | _delta() { |
| 6 | typeset -A opt_args |
| 7 | typeset -a _arguments_options |
| 8 | local ret=1 |
| 9 | |
| 10 | if is-at-least 5.2; then |
| 11 | _arguments_options=(-s -S -C) |
| 12 | else |
| 13 | _arguments_options=(-s -C) |
| 14 | fi |
| 15 | |
| 16 | local context curcontext="$curcontext" state line |
| 17 | _arguments "${_arguments_options[@]}" \ |
| 18 | '--blame-code-style=[Style string for the code section of a git blame line]:STYLE: ' \ |
| 19 | '--blame-format=[Format string for git blame commit metadata]:FMT: ' \ |
| 20 | '--blame-palette=[Background colors used for git blame lines (space-separated string)]:COLORS: ' \ |
| 21 | '--blame-separator-format=[Separator between the blame format and the code section of a git blame line]:FMT: ' \ |
| 22 | '--blame-separator-style=[Style string for the blame-separator-format]:STYLE: ' \ |
| 23 | '--blame-timestamp-format=[Format of \`git blame\` timestamp in raw git output received by delta]:FMT: ' \ |
| 24 | '--blame-timestamp-output-format=[Format string for git blame timestamp output]:FMT: ' \ |
| 25 | '--config=[Load the config file at PATH instead of ~/.gitconfig]:PATH:_files' \ |
| 26 | '--commit-decoration-style=[Style string for the commit hash decoration]:STYLE: ' \ |
| 27 | '--commit-regex=[Regular expression used to identify the commit line when parsing git output]:REGEX: ' \ |
| 28 | '--commit-style=[Style string for the commit hash line]:STYLE: ' \ |
| 29 | '--default-language=[Default language used for syntax highlighting]:LANG: ' \ |
| 30 | '--diff-stat-align-width=[Width allocated for file paths in a diff stat section]:N: ' \ |
| 31 | '--features=[Names of delta features to activate (space-separated)]:FEATURES: ' \ |
| 32 | '--file-added-label=[Text to display before an added file path]:STRING: ' \ |
| 33 | '--file-copied-label=[Text to display before a copied file path]:STRING: ' \ |
| 34 | '--file-decoration-style=[Style string for the file decoration]:STYLE: ' \ |
| 35 | '--file-modified-label=[Text to display before a modified file path]:STRING: ' \ |
| 36 | '--file-removed-label=[Text to display before a removed file path]:STRING: ' \ |
| 37 | '--file-renamed-label=[Text to display before a renamed file path]:STRING: ' \ |
| 38 | '--file-style=[Style string for the file section]:STYLE: ' \ |
| 39 | '--file-transformation=[Sed-style command transforming file paths for display]:SED_CMD: ' \ |
| 40 | '--generate-completion=[Print completion file for the given shell]:GENERATE_COMPLETION:(bash elvish fish powershell zsh)' \ |
| 41 | '--grep-context-line-style=[Style string for non-matching lines of grep output]:STYLE: ' \ |
| 42 | '--grep-file-style=[Style string for file paths in grep output]:STYLE: ' \ |
| 43 | '--grep-header-decoration-style=[Style string for the header decoration in grep output]:STYLE: ' \ |
| 44 | '--grep-header-file-style=[Style string for the file path part of the header in grep output]:STYLE: ' \ |
| 45 | '--grep-line-number-style=[Style string for line numbers in grep output]:STYLE: ' \ |
| 46 | '--grep-output-type=[Grep output format. Possible values\: "ripgrep" - file name printed once, followed by matching lines within that file, each preceded by a line number. "classic" - file name\:line number, followed by matching line. Default is "ripgrep" if \`rg --json\` format is detected, otherwise "classic"]:OUTPUT_TYPE:(ripgrep classic)' \ |
| 47 | '--grep-match-line-style=[Style string for matching lines of grep output]:STYLE: ' \ |
| 48 | '--grep-match-word-style=[Style string for the matching substrings within a matching line of grep output]:STYLE: ' \ |
| 49 | '--grep-separator-symbol=[Separator symbol printed after the file path and line number in grep output]:STRING: ' \ |
| 50 | '--hunk-header-decoration-style=[Style string for the hunk-header decoration]:STYLE: ' \ |
| 51 | '--hunk-header-file-style=[Style string for the file path part of the hunk-header]:STYLE: ' \ |
| 52 | '--hunk-header-line-number-style=[Style string for the line number part of the hunk-header]:STYLE: ' \ |
| 53 | '--hunk-header-style=[Style string for the hunk-header]:STYLE: ' \ |
| 54 | '--hunk-label=[Text to display before a hunk header]:STRING: ' \ |
| 55 | '--hyperlinks-commit-link-format=[Format string for commit hyperlinks (requires --hyperlinks)]:FMT: ' \ |
| 56 | '--hyperlinks-file-link-format=[Format string for file hyperlinks (requires --hyperlinks)]:FMT: ' \ |
| 57 | '--inline-hint-style=[Style string for short inline hint text]:STYLE: ' \ |
| 58 | '--inspect-raw-lines=[Kill-switch for --color-moved support]:true|false:(true false)' \ |
| 59 | '--line-buffer-size=[Size of internal line buffer]:N: ' \ |
| 60 | '--line-fill-method=[Line-fill method in side-by-side mode]:STRING:(ansi spaces)' \ |
| 61 | '--line-numbers-left-format=[Format string for the left column of line numbers]:FMT: ' \ |
| 62 | '--line-numbers-left-style=[Style string for the left column of line numbers]:STYLE: ' \ |
| 63 | '--line-numbers-minus-style=[Style string for line numbers in the old (minus) version of the file]:STYLE: ' \ |
| 64 | '--line-numbers-plus-style=[Style string for line numbers in the new (plus) version of the file]:STYLE: ' \ |
| 65 | '--line-numbers-right-format=[Format string for the right column of line numbers]:FMT: ' \ |
| 66 | '--line-numbers-right-style=[Style string for the right column of line numbers]:STYLE: ' \ |
| 67 | '--line-numbers-zero-style=[Style string for line numbers in unchanged (zero) lines]:STYLE: ' \ |
| 68 | '--map-styles=[Map styles encountered in raw input to desired output styles]:STYLES_MAP: ' \ |
| 69 | '--max-line-distance=[Maximum line pair distance parameter in within-line diff algorithm]:DIST: ' \ |
| 70 | '--max-line-length=[Truncate lines longer than this]:N: ' \ |
| 71 | '--merge-conflict-begin-symbol=[String marking the beginning of a merge conflict region]:STRING: ' \ |
| 72 | '--merge-conflict-end-symbol=[String marking the end of a merge conflict region]:STRING: ' \ |
| 73 | '--merge-conflict-ours-diff-header-decoration-style=[Style string for the decoration of the header above the '\''ours'\'' merge conflict diff]:STYLE: ' \ |
| 74 | '--merge-conflict-ours-diff-header-style=[Style string for the header above the '\''ours'\'' branch merge conflict diff]:STYLE: ' \ |
| 75 | '--merge-conflict-theirs-diff-header-decoration-style=[Style string for the decoration of the header above the '\''theirs'\'' merge conflict diff]:STYLE: ' \ |
| 76 | '--merge-conflict-theirs-diff-header-style=[Style string for the header above the '\''theirs'\'' branch merge conflict diff]:STYLE: ' \ |
| 77 | '--minus-empty-line-marker-style=[Style string for removed empty line marker]:STYLE: ' \ |
| 78 | '--minus-emph-style=[Style string for emphasized sections of removed lines]:STYLE: ' \ |
| 79 | '--minus-non-emph-style=[Style string for non-emphasized sections of removed lines that have an emphasized section]:STYLE: ' \ |
| 80 | '--minus-style=[Style string for removed lines]:STYLE: ' \ |
| 81 | '--navigate-regex=[Regular expression defining navigation stop points]:REGEX: ' \ |
| 82 | '--pager=[Which pager to use]:CMD: ' \ |
| 83 | '--paging=[Whether to use a pager when displaying output]:auto|always|never:(auto always never)' \ |
| 84 | '--plus-emph-style=[Style string for emphasized sections of added lines]:STYLE: ' \ |
| 85 | '--plus-empty-line-marker-style=[Style string for added empty line marker]:STYLE: ' \ |
| 86 | '--plus-non-emph-style=[Style string for non-emphasized sections of added lines that have an emphasized section]:STYLE: ' \ |
| 87 | '--plus-style=[Style string for added lines]:STYLE: ' \ |
| 88 | '--right-arrow=[Text to display with a changed file path]:STRING: ' \ |
| 89 | '--syntax-theme=[The syntax-highlighting theme to use]:SYNTAX_THEME: ' \ |
| 90 | '--tabs=[The number of spaces to replace tab characters with]:N: ' \ |
| 91 | '--true-color=[Whether to emit 24-bit ("true color") RGB color codes]:auto|always|never:(auto always never)' \ |
| 92 | '--whitespace-error-style=[Style string for whitespace errors]:STYLE: ' \ |
| 93 | '-w+[The width of underline/overline decorations]:N: ' \ |
| 94 | '--width=[The width of underline/overline decorations]:N: ' \ |
| 95 | '--word-diff-regex=[Regular expression defining a '\''word'\'' in within-line diff algorithm]:REGEX: ' \ |
| 96 | '--wrap-left-symbol=[End-of-line wrapped content symbol (left-aligned)]:STRING: ' \ |
| 97 | '--wrap-max-lines=[How often a line should be wrapped if it does not fit]:N: ' \ |
| 98 | '--wrap-right-percent=[Threshold for right-aligning wrapped content]:PERCENT: ' \ |
| 99 | '--wrap-right-prefix-symbol=[Pre-wrapped content symbol (right-aligned)]:STRING: ' \ |
| 100 | '--wrap-right-symbol=[End-of-line wrapped content symbol (right-aligned)]:STRING: ' \ |
| 101 | '--zero-style=[Style string for unchanged lines]:STYLE: ' \ |
| 102 | '--24-bit-color=[Deprecated\: use --true-color]:auto|always|never:(auto always never)' \ |
| 103 | '--color-only[Do not alter the input structurally in any way]' \ |
| 104 | '--dark[Use default colors appropriate for a dark terminal background]' \ |
| 105 | '--diff-highlight[Emulate diff-highlight]' \ |
| 106 | '--diff-so-fancy[Emulate diff-so-fancy]' \ |
| 107 | '--hyperlinks[Render commit hashes, file names, and line numbers as hyperlinks]' \ |
| 108 | '--keep-plus-minus-markers[Prefix added/removed lines with a +/- character, as git does]' \ |
| 109 | '--light[Use default colors appropriate for a light terminal background]' \ |
| 110 | '-n[Display line numbers next to the diff]' \ |
| 111 | '--line-numbers[Display line numbers next to the diff]' \ |
| 112 | '--list-languages[List supported languages and associated file extensions]' \ |
| 113 | '--list-syntax-themes[List available syntax-highlighting color themes]' \ |
| 114 | '--navigate[Activate diff navigation]' \ |
| 115 | '--no-gitconfig[Do not read any settings from git config]' \ |
| 116 | '--parse-ansi[Display ANSI color escape sequences in human-readable form]' \ |
| 117 | '--raw[Do not alter the input in any way]' \ |
| 118 | '--relative-paths[Output all file paths relative to the current directory]' \ |
| 119 | '--show-colors[Show available named colors]' \ |
| 120 | '--show-config[Display the active values for all Delta options]' \ |
| 121 | '--show-syntax-themes[Show example diff for available syntax-highlighting themes]' \ |
| 122 | '--show-themes[Show example diff for available delta themes]' \ |
| 123 | '-s[Display diffs in side-by-side layout]' \ |
| 124 | '--side-by-side[Display diffs in side-by-side layout]' \ |
| 125 | '-h[Print help (see more with '\''--help'\'')]' \ |
| 126 | '--help[Print help (see more with '\''--help'\'')]' \ |
| 127 | '-V[Print version]' \ |
| 128 | '--version[Print version]' \ |
| 129 | '::minus_file -- First file to be compared when delta is being used in diff mode:_files' \ |
| 130 | '::plus_file -- Second file to be compared when delta is being used in diff mode:_files' \ |
| 131 | && ret=0 |
| 132 | } |
| 133 | |
| 134 | (( $+functions[_delta_commands] )) || |
| 135 | _delta_commands() { |
| 136 | local commands; commands=() |
| 137 | _describe -t commands 'delta commands' commands "$@" |
| 138 | } |
| 139 | |
| 140 | if [ "$funcstack[1]" = "_delta" ]; then |
| 141 | _delta "$@" |
| 142 | else |
| 143 | compdef _delta delta |
| 144 | fi |