mirror of https://gitee.com/openkylin/linux.git
scripts/dtc: dtx_diff - add color output support
Add new -c/--color options, to enhance the diff output with color, and improve the user's experience. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Frank Rowand <frank.rowand@sony.com> Tested-by: Frank Rowand <frank.rowand@sony.com> Signed-off-by: Rob Herring <robh@kernel.org>
This commit is contained in:
parent
692a0dc734
commit
1ee1ffe1f0
|
@ -20,6 +20,8 @@ Usage:
|
||||||
|
|
||||||
|
|
||||||
--annotate synonym for -T
|
--annotate synonym for -T
|
||||||
|
--color synonym for -c (requires diff with --color support)
|
||||||
|
-c enable colored output
|
||||||
-f print full dts in diff (--unified=99999)
|
-f print full dts in diff (--unified=99999)
|
||||||
-h synonym for --help
|
-h synonym for --help
|
||||||
-help synonym for --help
|
-help synonym for --help
|
||||||
|
@ -177,6 +179,7 @@ compile_to_dts() {
|
||||||
annotate=""
|
annotate=""
|
||||||
cmd_diff=0
|
cmd_diff=0
|
||||||
diff_flags="-u"
|
diff_flags="-u"
|
||||||
|
diff_color=""
|
||||||
dtx_file_1=""
|
dtx_file_1=""
|
||||||
dtx_file_2=""
|
dtx_file_2=""
|
||||||
dtc_sort="-s"
|
dtc_sort="-s"
|
||||||
|
@ -188,6 +191,13 @@ while [ $# -gt 0 ] ; do
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
|
|
||||||
|
-c | --color )
|
||||||
|
if diff --color /dev/null /dev/null 2>/dev/null ; then
|
||||||
|
diff_color="--color=always"
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
-f )
|
-f )
|
||||||
diff_flags="--unified=999999"
|
diff_flags="--unified=999999"
|
||||||
shift
|
shift
|
||||||
|
@ -343,7 +353,7 @@ DTC="\
|
||||||
|
|
||||||
if (( ${cmd_diff} )) ; then
|
if (( ${cmd_diff} )) ; then
|
||||||
|
|
||||||
diff ${diff_flags} --label "${dtx_file_1}" --label "${dtx_file_2}" \
|
diff ${diff_flags} ${diff_color} --label "${dtx_file_1}" --label "${dtx_file_2}" \
|
||||||
<(compile_to_dts "${dtx_file_1}" "${dtx_path_1_dtc_include}") \
|
<(compile_to_dts "${dtx_file_1}" "${dtx_path_1_dtc_include}") \
|
||||||
<(compile_to_dts "${dtx_file_2}" "${dtx_path_2_dtc_include}")
|
<(compile_to_dts "${dtx_file_2}" "${dtx_path_2_dtc_include}")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue