diffpkg: allow to choose between unified context and two columns
This commit is contained in:
parent
6bd7e70e68
commit
b9dadc5576
|
@ -47,6 +47,8 @@ _diffpkg_args=(
|
||||||
'(-p --pkginfo)'{-p,--pkginfo}'[.PKGINFO diff mode]'
|
'(-p --pkginfo)'{-p,--pkginfo}'[.PKGINFO diff mode]'
|
||||||
'(-b --buildinfo)'{-b,--buildinfo}'[.BUILDINFO diff mode]'
|
'(-b --buildinfo)'{-b,--buildinfo}'[.BUILDINFO diff mode]'
|
||||||
'(-m --makepkg-config)'{-m,--makepkg-config}'[Location of a makepkg config file]:makepkg_config:_files -g "*.conf(.)"'
|
'(-m --makepkg-config)'{-m,--makepkg-config}'[Location of a makepkg config file]:makepkg_config:_files -g "*.conf(.)"'
|
||||||
|
'(-u -U --unified)'{-u,-U,--unified}'[Output 3 lines of unified context]'
|
||||||
|
'(-y --side-by-side)'{-y,--side-by-side}'[Output in two columns]'
|
||||||
'(-v --verbose)'{-v,--verbose}'[Provide more detailed/unfiltered output]'
|
'(-v --verbose)'{-v,--verbose}'[Provide more detailed/unfiltered output]'
|
||||||
'(-h --help)'{-h,--help}'[Display usage]'
|
'(-h --help)'{-h,--help}'[Display usage]'
|
||||||
'*:packages:_devtools_completions_all_packages'
|
'*:packages:_devtools_completions_all_packages'
|
||||||
|
|
|
@ -36,6 +36,15 @@ Options
|
||||||
*-h, --help*::
|
*-h, --help*::
|
||||||
Show a help text
|
Show a help text
|
||||||
|
|
||||||
|
Output Options
|
||||||
|
--------------
|
||||||
|
|
||||||
|
*-u, -U, --unified*::
|
||||||
|
Output 3 lines of unified context
|
||||||
|
|
||||||
|
*-y, --side-by-side*::
|
||||||
|
Output in two columns
|
||||||
|
|
||||||
Modes
|
Modes
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,10 @@ usage() {
|
||||||
-v, --verbose Provide more detailed/unfiltered output
|
-v, --verbose Provide more detailed/unfiltered output
|
||||||
-h, --help Show this help text
|
-h, --help Show this help text
|
||||||
|
|
||||||
|
OUTPUT OPTIONS
|
||||||
|
-u, -U, --unified Output 3 lines of unified context
|
||||||
|
-y, --side-by-side Output in two columns
|
||||||
|
|
||||||
MODES
|
MODES
|
||||||
-l, --list Activate content list diff mode (default)
|
-l, --list Activate content list diff mode (default)
|
||||||
-d, --diffoscope Activate diffoscope diff mode
|
-d, --diffoscope Activate diffoscope diff mode
|
||||||
|
@ -42,6 +46,9 @@ DIFFOSCOPE=0
|
||||||
PKGINFO=0
|
PKGINFO=0
|
||||||
BUILDINFO=0
|
BUILDINFO=0
|
||||||
|
|
||||||
|
DIFFMODE=--side-by-side
|
||||||
|
DIFFOPTIONS=(--expand-tabs)
|
||||||
|
|
||||||
# option checking
|
# option checking
|
||||||
while (( $# )); do
|
while (( $# )); do
|
||||||
case $1 in
|
case $1 in
|
||||||
|
@ -73,6 +80,14 @@ while (( $# )); do
|
||||||
VERBOSE=1
|
VERBOSE=1
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
-u|-U|--unified)
|
||||||
|
DIFFMODE=--unified
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-y|--side-by-side)
|
||||||
|
DIFFMODE=--side-by-side
|
||||||
|
shift
|
||||||
|
;;
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
|
@ -86,6 +101,15 @@ while (( $# )); do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if (( VERBOSE )); then
|
||||||
|
if [[ $DIFFMODE == --unified ]]; then
|
||||||
|
DIFFMODE="--unified=99999"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
DIFFOPTIONS+=(--suppress-common-lines)
|
||||||
|
fi
|
||||||
|
DIFFOPTIONS+=("${DIFFMODE}")
|
||||||
|
|
||||||
if ! (( DIFFOSCOPE || TARLIST || PKGINFO || BUILDINFO )); then
|
if ! (( DIFFOSCOPE || TARLIST || PKGINFO || BUILDINFO )); then
|
||||||
TARLIST=1
|
TARLIST=1
|
||||||
fi
|
fi
|
||||||
|
@ -128,25 +152,27 @@ diff_pkgs() {
|
||||||
[[ -f $oldpkg ]] || die "No such file: %s" "${oldpkg}"
|
[[ -f $oldpkg ]] || die "No such file: %s" "${oldpkg}"
|
||||||
[[ -f $newpkg ]] || die "No such file: %s" "${newpkg}"
|
[[ -f $newpkg ]] || die "No such file: %s" "${newpkg}"
|
||||||
|
|
||||||
|
DIFFOPTIONS+=(--label "${oldpkg}" --label "${newpkg}")
|
||||||
|
|
||||||
if (( TARLIST )); then
|
if (( TARLIST )); then
|
||||||
tar_list "$oldpkg" > "$TMPDIR/filelist-old"
|
tar_list "$oldpkg" > "$TMPDIR/filelist-old"
|
||||||
tar_list "$newpkg" > "$TMPDIR/filelist"
|
tar_list "$newpkg" > "$TMPDIR/filelist"
|
||||||
|
|
||||||
sdiff -s "$TMPDIR/filelist-old" "$TMPDIR/filelist"
|
diff "${DIFFOPTIONS[@]}" "$TMPDIR/filelist-old" "$TMPDIR/filelist"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( PKGINFO )); then
|
if (( PKGINFO )); then
|
||||||
bsdtar xOqf "$oldpkg" .PKGINFO > "$TMPDIR/pkginfo-old"
|
bsdtar xOqf "$oldpkg" .PKGINFO > "$TMPDIR/pkginfo-old"
|
||||||
bsdtar xOqf "$newpkg" .PKGINFO > "$TMPDIR/pkginfo"
|
bsdtar xOqf "$newpkg" .PKGINFO > "$TMPDIR/pkginfo"
|
||||||
|
|
||||||
sdiff -s "$TMPDIR/pkginfo-old" "$TMPDIR/pkginfo"
|
diff "${DIFFOPTIONS[@]}" "$TMPDIR/pkginfo-old" "$TMPDIR/pkginfo"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( BUILDINFO )); then
|
if (( BUILDINFO )); then
|
||||||
bsdtar xOqf "$oldpkg" .BUILDINFO > "$TMPDIR/buildinfo-old"
|
bsdtar xOqf "$oldpkg" .BUILDINFO > "$TMPDIR/buildinfo-old"
|
||||||
bsdtar xOqf "$newpkg" .BUILDINFO > "$TMPDIR/buildinfo"
|
bsdtar xOqf "$newpkg" .BUILDINFO > "$TMPDIR/buildinfo"
|
||||||
|
|
||||||
sdiff -s "$TMPDIR/buildinfo-old" "$TMPDIR/buildinfo"
|
diff "${DIFFOPTIONS[@]}" "$TMPDIR/buildinfo-old" "$TMPDIR/buildinfo"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( DIFFOSCOPE )); then
|
if (( DIFFOSCOPE )); then
|
||||||
|
|
Loading…
Reference in New Issue