版本比较
cwdiff
正文
增加 110 行删除 21 行
11233456789101112131415161718192021222324258926272829303132333435361920212223242526272829303738394034414243444513 行未改动596061625657636465666715 行未改动838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718816 行未改动205206207208132209210134211212213214215216217218219220221222223224225## cwdiff 1.0.0## cwdiff 1.1.0
### 源代码(POSIX Shell 脚本)- 修复了一些已知问题- 增加通过 `WDIFF` 环境变量设置 `wdiff` 程序的功能。
:::info[源代码(POSIX Shell 脚本)]
```sh#!/bin/shreadonly escape="$(printf "\033")"readonly help="Usage: ${0##*/} [OPTION]... [FILE1] [FILE2]Compares words in two files and report differences, with color support.
Mandatory arguments to long options are mandatory for short options too. -h, --help display this help and exit -v, --version output version information and exit --color[=WHEN] color output; WHEN is 'never', 'always', or 'auto'; plain --color means --color='auto'
Other options are the same as for 'wdiff'."readonly version="cwdiff 1.1.0"if [ -z "$WDIFF" ]then WDIFF=wdifffistatus=0 wdiff_options= color=never sd='[-' ed='-]' si='{+' ei='+}'options="$(getopt -n "${0##*/}" -o "hvC123isapltw:x:y:z:nd" -l "help,version,copyright,color::,no-deleted,no-inserted,no-common,ignore-case,statistics,auto-pager,printer,less-mode,terminal,start-delete:,end-delete:,start-insert:,end-insert:,avoid-wraps,diff-input" -- "$@")"status=0 wdiff_options= color=never default_sd=1 default_ed=1 default_si=1 default_ei=1 sd='[-' ed='-]' si='{+' ei='+}'options="$(getopt -s sh -n "${0##*/}" -o "hvC123isapltw:x:y:z:nd" -l "help,version,copyright,color::,no-deleted,no-inserted,no-common,ignore-case,statistics,auto-pager,printer,less-mode,terminal,start-delete:,end-delete:,start-insert:,end-insert:,avoid-wraps,diff-input" -- "$@")"if [ $? -ne 0 ]then status=2fieval set -- "$options"while [ "$1" != -- ]do case "$1" in -h|--help) cat << EOFUsage: ${0##*/} [OPTION]... [FILE1] [FILE2]Compares words in two files and report differences, with color support.
Mandatory arguments to long options are mandatory for short options too. -h, --help display this help and exit -v, --version output version information and exit --color[=WHEN] color output; WHEN is 'never', 'always', or 'auto'; plain --color means --color='auto'
Other options are the same as for 'wdiff'.EOF echo "$help" exit 0 ;; -v|--version) echo "cwdiff 1.0.0" echo "$version" exit 0 ;; --color) case "$2" in13 行未改动 esac shift 2 ;; -C|--copyright) wdiff -C exit 0 exec $WDIFF -C ;; -1|--no-deleted) wdiff_options="${wdiff_options}1" shift15 行未改动 shift ;; -a|--auto-paper) wdiff_options="${wdiff_options}a" if [ -t 1 ] then if [ $default_sd -eq 1 ] then sd= fi if [ $default_ed -eq 1 ] then ed= fi if [ $default_si -eq 1 ] then si= fi if [ $default_ei -eq 1 ] then ei= fi fi shift ;; -p|--printer) wdiff_options="${wdiff_options}p" if [ $default_sd -eq 1 ] then sd= fi if [ $default_ed -eq 1 ] then ed= fi if [ $default_si -eq 1 ] then si= fi if [ $default_ei -eq 1 ] then ei= fi shift ;; -l|--less-mode) wdiff_options="${wdiff_options}l" if [ $default_sd -eq 1 ] then sd= fi if [ $default_ed -eq 1 ] then ed= fi if [ $default_si -eq 1 ] then si= fi if [ $default_ei -eq 1 ] then ei= fi shift ;; -t|--terminal) wdiff_options="${wdiff_options}t" if [ $default_sd -eq 1 ] then sd= fi if [ $default_ed -eq 1 ] then ed= fi if [ $default_si -eq 1 ] then si= fi if [ $default_ei -eq 1 ] then ei= fi shift ;; -w|--start-delete) default_sd=0 sd="$2" shift 2 ;; -x|--end-delete) default_ed=0 ed="$2" shift 2 ;; -y|--start-insert) default_si=0 si="$2" shift 2 ;; -z|--end-insert) default_ei=0 ei="$2" shift 2 ;; -n|--avoid-wraps)16 行未改动 wdiff_options="-$wdiff_options"fiif [ $color = always -o \( $color = auto -a -t 1 \) ]then exec wdiff $wdiff_options -w "$escape[31m$sd" -x "$ed$escape[m" -y "$escape[32m$si" -z "$ei$escape[m" "$@" exec $WDIFF $wdiff_options -w "$escape[31m$sd" -x "$ed$escape[m" -y "$escape[32m$si" -z "$ei$escape[m" "$@"else exec wdiff $wdiff_options -w "$sd" -x "$ed" -y "$si" -z "$ei" "$@" exec $WDIFF $wdiff_options -w "$sd" -x "$ed" -y "$si" -z "$ei" "$@"fi```
:::
## cwdiff 1.0.2
- 修复了一些已知问题
## cwdiff 1.0.1
- 修复了一些已知问题
## cwdiff 1.0.0