diffpkg: add colored output option with default of auto
This commit is contained in:
parent
b9dadc5576
commit
ba070f1ca9
|
@ -6,6 +6,7 @@ m4_include(lib/valid-tags.sh)
|
||||||
m4_include(lib/valid-repos.sh)
|
m4_include(lib/valid-repos.sh)
|
||||||
|
|
||||||
_binary_arch=${_arch[*]:0:-1}
|
_binary_arch=${_arch[*]:0:-1}
|
||||||
|
_colors=(never always auto)
|
||||||
|
|
||||||
_archbuild_args=(
|
_archbuild_args=(
|
||||||
'-c[Recreate the chroot before building]'
|
'-c[Recreate the chroot before building]'
|
||||||
|
@ -49,6 +50,7 @@ _diffpkg_args=(
|
||||||
'(-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]'
|
'(-u -U --unified)'{-u,-U,--unified}'[Output 3 lines of unified context]'
|
||||||
'(-y --side-by-side)'{-y,--side-by-side}'[Output in two columns]'
|
'(-y --side-by-side)'{-y,--side-by-side}'[Output in two columns]'
|
||||||
|
'--color=[Color output]:when:($_colors[*])'
|
||||||
'(-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'
|
||||||
|
|
|
@ -39,6 +39,9 @@ Options
|
||||||
Output Options
|
Output Options
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
*--color*[='WHEN']::
|
||||||
|
Color output; 'WHEN' is `'never'`, `'always'`, or `'auto'`; Plain *--color* means *--color='auto'*
|
||||||
|
|
||||||
*-u, -U, --unified*::
|
*-u, -U, --unified*::
|
||||||
Output 3 lines of unified context
|
Output 3 lines of unified context
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,8 @@ usage() {
|
||||||
-h, --help Show this help text
|
-h, --help Show this help text
|
||||||
|
|
||||||
OUTPUT OPTIONS
|
OUTPUT OPTIONS
|
||||||
|
--color[=WHEN] Color output; WHEN is 'never', 'always', or 'auto';
|
||||||
|
Plain --color means --color='auto'
|
||||||
-u, -U, --unified Output 3 lines of unified context
|
-u, -U, --unified Output 3 lines of unified context
|
||||||
-y, --side-by-side Output in two columns
|
-y, --side-by-side Output in two columns
|
||||||
|
|
||||||
|
@ -47,6 +49,7 @@ PKGINFO=0
|
||||||
BUILDINFO=0
|
BUILDINFO=0
|
||||||
|
|
||||||
DIFFMODE=--side-by-side
|
DIFFMODE=--side-by-side
|
||||||
|
DIFFCOLOR=--color
|
||||||
DIFFOPTIONS=(--expand-tabs)
|
DIFFOPTIONS=(--expand-tabs)
|
||||||
|
|
||||||
# option checking
|
# option checking
|
||||||
|
@ -88,6 +91,15 @@ while (( $# )); do
|
||||||
DIFFMODE=--side-by-side
|
DIFFMODE=--side-by-side
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--color|--color=*)
|
||||||
|
if [[ $2 == never || $2 == always || $2 == auto ]]; then
|
||||||
|
DIFFCOLOR="--color=$2"
|
||||||
|
shift 2
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
DIFFCOLOR="$1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
|
@ -108,7 +120,7 @@ if (( VERBOSE )); then
|
||||||
else
|
else
|
||||||
DIFFOPTIONS+=(--suppress-common-lines)
|
DIFFOPTIONS+=(--suppress-common-lines)
|
||||||
fi
|
fi
|
||||||
DIFFOPTIONS+=("${DIFFMODE}")
|
DIFFOPTIONS+=("${DIFFMODE}" "${DIFFCOLOR}")
|
||||||
|
|
||||||
if ! (( DIFFOSCOPE || TARLIST || PKGINFO || BUILDINFO )); then
|
if ! (( DIFFOSCOPE || TARLIST || PKGINFO || BUILDINFO )); then
|
||||||
TARLIST=1
|
TARLIST=1
|
||||||
|
|
Loading…
Reference in New Issue