* [PATCH v3] scripts/dtc: dtx_diff - add color output support
@ 2019-10-25 9:22 Geert Uytterhoeven
2019-11-04 15:02 ` Rob Herring
0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2019-10-25 9:22 UTC (permalink / raw)
To: Rob Herring, Frank Rowand; +Cc: devicetree, linux-kernel, Geert Uytterhoeven
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>
---
v3:
- Add Reviewed-by, Tested-by,
v2:
- Document that -c/--color requires a diff command with color support,
- Ignore -c/--color if diff command lacks color support.
---
scripts/dtc/dtx_diff | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/scripts/dtc/dtx_diff b/scripts/dtc/dtx_diff
index e9ad7834a22d9459..d3422ee15e300bc7 100755
--- a/scripts/dtc/dtx_diff
+++ b/scripts/dtc/dtx_diff
@@ -20,6 +20,8 @@ Usage:
--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)
-h synonym for --help
-help synonym for --help
@@ -178,6 +180,7 @@ compile_to_dts() {
annotate=""
cmd_diff=0
diff_flags="-u"
+diff_color=""
dtx_file_1=""
dtx_file_2=""
dtc_sort="-s"
@@ -189,6 +192,13 @@ while [ $# -gt 0 ] ; do
case $1 in
+ -c | --color )
+ if diff --color /dev/null /dev/null 2>/dev/null ; then
+ diff_color="--color=always"
+ fi
+ shift
+ ;;
+
-f )
diff_flags="--unified=999999"
shift
@@ -344,7 +354,7 @@ DTC="\
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_2}" "${dtx_path_2_dtc_include}")
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3] scripts/dtc: dtx_diff - add color output support
2019-10-25 9:22 [PATCH v3] scripts/dtc: dtx_diff - add color output support Geert Uytterhoeven
@ 2019-11-04 15:02 ` Rob Herring
0 siblings, 0 replies; 2+ messages in thread
From: Rob Herring @ 2019-11-04 15:02 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Frank Rowand, devicetree, linux-kernel
On Fri, Oct 25, 2019 at 11:22:15AM +0200, Geert Uytterhoeven wrote:
> 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>
> ---
> v3:
> - Add Reviewed-by, Tested-by,
>
> v2:
> - Document that -c/--color requires a diff command with color support,
> - Ignore -c/--color if diff command lacks color support.
> ---
> scripts/dtc/dtx_diff | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
Applied, thanks.
Rob
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-04 15:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-25 9:22 [PATCH v3] scripts/dtc: dtx_diff - add color output support Geert Uytterhoeven
2019-11-04 15:02 ` Rob Herring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).