Skip to contentSkip to conversation

scripts/tags: merge "TAGS" and "tags" in case

PATCH In review Zhaoyu Liu 2 participants 3 messages Nov 3, 2021 – Nov 27, 2021

lore
Share & tools
lore

Zhaoyu Liu

author
#0 lore raw

PATCH 1/1 scripts/tags: merge "TAGS" and "tags" in case

merge "TAGS" and "tags" for the code more concise

---
 scripts/tags.sh | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
scripts/tags.sh +5 -9
index 16d475b3e203..a9181dd0fee2 100755
@@ -315,15 +315,11 @@ case "$1" in
 		dogtags
 		;;
 
-	"tags")
-		rm -f tags
-		xtags ctags
-		remove_structs=y
-		;;
-
-	"TAGS")
-		rm -f TAGS
-		xtags etags
+	"TAGS" | "tags")
+		rm -f $1
+		xtags $([ $1 = "tags" ]	\
+			&& echo ctags		\
+			|| echo etags)
 		remove_structs=y
 		;;
 esac
Signature · 1 line
2.17.1
#1 lore raw
Quoted 21 lines · Zhaoyu Liu

merge "TAGS" and "tags" for the code more concise

---
 scripts/tags.sh | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
scripts/tags.sh +0 -6
index 16d475b3e203..a9181dd0fee2 100755
@@ -315,15 +315,11 @@ case "$1" in
 		dogtags
 		;;
 
-	"tags")
-		rm -f tags
-		xtags ctags
-		remove_structs=y
-		;;
-

scripts/tags.sh case "$1" in · line 324

Quoted 10 lines
scripts/tags.sh +5 -3
-	"TAGS")
-		rm -f TAGS
-		xtags etags
+	"TAGS" | "tags")
+		rm -f $1
+		xtags $([ $1 = "tags" ]	\
+			&& echo ctags		\
+			|| echo etags)
 		remove_structs=y
 		;;

Ick, that's much harder to read and understand.

What is wrong with the existing code? It's obvious and makes sense, it is not duplicating any lines here except the one "remove_structs=y" which is fine.

I'm not going to take this, sorry.

greg k-h

#2 lore raw
Quoted 35 lines · Greg KH
Quoted 21 lines · Zhaoyu Liu

merge "TAGS" and "tags" for the code more concise

---
 scripts/tags.sh | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
scripts/tags.sh +0 -6
index 16d475b3e203..a9181dd0fee2 100755
@@ -315,15 +315,11 @@ case "$1" in
 		dogtags
 		;;
 
-	"tags")
-		rm -f tags
-		xtags ctags
-		remove_structs=y
-		;;
-

scripts/tags.sh case "$1" in · line 324

Quoted 10 lines
scripts/tags.sh +5 -3
-	"TAGS")
-		rm -f TAGS
-		xtags etags
+	"TAGS" | "tags")
+		rm -f $1
+		xtags $([ $1 = "tags" ]	\
+			&& echo ctags		\
+			|| echo etags)
 		remove_structs=y
 		;;

Ick, that's much harder to read and understand.

Quoted 8 lines

What is wrong with the existing code? It's obvious and makes sense, it is not duplicating any lines here except the one "remove_structs=y" which is fine.

I'm not going to take this, sorry.

greg k-h

Ok you're right, Easy to understand is better.
Thank you.

zackary