diff options
| author | Tanaka Akira <akr@users.sourceforge.net> | 2000-01-27 20:06:57 +0000 |
|---|---|---|
| committer | Tanaka Akira <akr@users.sourceforge.net> | 2000-01-27 20:06:57 +0000 |
| commit | 68bfbb5bdefbbf1630e1ef6722b864c463dfe3a7 (patch) | |
| tree | 13291f51b66831af942eca6431c68a9af9033ec8 | |
| parent | Initial revision (diff) | |
| download | zsh-68bfbb5bdefbbf1630e1ef6722b864c463dfe3a7.tar zsh-68bfbb5bdefbbf1630e1ef6722b864c463dfe3a7.tar.gz zsh-68bfbb5bdefbbf1630e1ef6722b864c463dfe3a7.tar.bz2 zsh-68bfbb5bdefbbf1630e1ef6722b864c463dfe3a7.tar.lz zsh-68bfbb5bdefbbf1630e1ef6722b864c463dfe3a7.tar.xz zsh-68bfbb5bdefbbf1630e1ef6722b864c463dfe3a7.tar.zst zsh-68bfbb5bdefbbf1630e1ef6722b864c463dfe3a7.zip | |
Initial revision
| -rw-r--r-- | Completion/User/_diff | 3 | ||||
| -rw-r--r-- | Completion/User/_diff_options | 127 |
2 files changed, 130 insertions, 0 deletions
diff --git a/Completion/User/_diff b/Completion/User/_diff new file mode 100644 index 000000000..45f15c270 --- /dev/null +++ b/Completion/User/_diff @@ -0,0 +1,3 @@ +#compdef diff + +_diff_options ':original file:_files' ':new file:_files' diff --git a/Completion/User/_diff_options b/Completion/User/_diff_options new file mode 100644 index 000000000..0ac110452 --- /dev/null +++ b/Completion/User/_diff_options @@ -0,0 +1,127 @@ +#autoload + +local of ofwuc ouc oss ofwy ofwg ofwl + +(( $+_diff_is_gnu )) || { + _diff_is_gnu=0; + [[ $(diff -v </dev/null) == *GNU* ]] && _diff_is_gnu=1 +} + +if (( _diff_is_gnu )) +then + # output formats + of="-y --side-by-side -n --rcs -e -f --ed -q --brief -c -C --context -u -U \ + --unified --old-group-format --new-group-format --changed-group-format \ + --unchanged-group-format --line-format --old-line-format --new-line-format \ + --changed-line-format" + + # output formats w/o unified and context + ofwuc="-y --side-by-side -n --rcs -e -f --ed -q --brief --old-group-format \ + --new-group-format --changed-group-format --unchanged-group-format \ + --line-format --old-line-format --new-line-format --changed-line-format" + + # option specific to unified or context diff + ouc='-L --label -p --show-c-function -F --show-function-line' + + # option specific to side by side + oss='-W --width --left-column --suppress-common-lines' + + # output formats w/o side by side + ofwy="-n --rcs -e -f --ed -q --brief -c -C --context -u -U --unified \ + --old-group-format --new-group-format --changed-group-format \ + --unchanged-group-format --line-format --old-line-format \ + --new-line-format --changed-line-format" + + # output formats w/o group format + ofwg="-n --rcs -e -f --ed -q --brief -c -C --context -u -U --unified \ + --line-format --old-line-format --new-line-format --changed-line-format" + + # output formats w/o line format + ofwl="-n --rcs -e -f --ed -q --brief -c -C --context -u -U --unified \ + --old-group-format --new-group-format --changed-group-format \ + --unchanged-group-format" + + _arguments -s \ + '(-i)--ignore-case[case insensitive]' \ + '(--ignore-case)-i[case insensitive]' \ + '(-w)--ignore-all-space[ignore all white space]' \ + '(--ignore-all-space)-w[ignore all white space]' \ + '(-b)--ignore-space-change[ignore changes in the amount of white space]' \ + '(--ignore-space-change)-b[ignore changes in the amount of white space]' \ + '(-B)--ignore-blank-lines[ignore lines that are all blank]' \ + '(--ignore-blank-lines)-B[ignore lines that are all blank]' \ + '(-I)--ignore-matching-lines=[ignore lines that match regex]:regex:' \ + '(--ignore-matching-lines)-I[ignore lines that match regex]:regex:' \ + '(-a)--text[treat all files as text]' \ + '(--text)-a[treat all files as text]' \ + "($of $oss)--context=[context diff]::# lines of copied context:" \ + "($of $oss)-C[output a context diff]:# lines of copied context:" \ + "($of $oss)-c[output a context diff]" \ + "($of $oss)--unified=[output a unified diff]::# lines of unified context:" \ + "($of $oss)-U[output a unified diff]:# lines of unified context:" \ + "($of $oss)-u[output a unified diff]" \ + "($ofwuc $oss -L)--label[set label to use instead of file name]:label:" \ + "($ofwuc $oss --label)-L[set label to use instead of file name]:label:" \ + "($ofwuc $oss -p)--show-c-function[show C function of each change]" \ + "($ofwuc $oss --show-c-function)-p[show C function of each change]" \ + "($ofwuc $oss -F)--show-function-line=[show the most recent line matching regex]:regex:" \ + "($ofwuc $oss --show-function-line)-F[show the most recent line matching regex]:regex:" \ + "($of $ouc $oss)--brief[output only whether files differ]" \ + "($of $ouc $oss)-q[output only whether files differ]" \ + "($of $ouc $oss)--ed[output an ed script]" \ + "($of $ouc $oss)-f[output a reversed ed script]" \ + "($of $ouc $oss)-e[output an ed script]" \ + "($of $ouc $oss)--rcs[RCS format diff]" \ + "($of $ouc $oss)-n[RCS format diff]" \ + "($of $ouc)--side-by-side[output in two columns]" \ + "($of $ouc)-y[output in two columns]" \ + "($ofwy $ouc -W)--width[set size of line]:# characters per line:" \ + "($ofwy $ouc --width)-W[set size of line]:# characters per line:" \ |
