From: Thomas Debesse <dev@illwieckz.net>
Date: Mon, 3 May 2021 04:57:10 +0000 (+0200)
Subject: q3map2/help: add -help all
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=713a3ca743b8db16e037fe8880df44c0458fce6e;p=xonotic%2Fnetradiant.git

q3map2/help: add -help all
---

diff --git a/tools/quake3/q3map2/help.c b/tools/quake3/q3map2/help.c
index f6974a6c..56916b63 100644
--- a/tools/quake3/q3map2/help.c
+++ b/tools/quake3/q3map2/help.c
@@ -462,7 +462,8 @@ void HelpGames()
 void HelpMain(const char* arg)
 {
 	printf("Usage: q3map2 [stage] [common options...] [stage options...] [stage source file]\n");
-	printf("       q3map2 -help [stage]\n\n");
+	printf("       q3map2 -help [stage]\n");
+	printf("       q3map2 -help all\n\n");
 
 	static char termbuf[2048];
 	char *termtype = getenv("TERM");
@@ -507,15 +508,29 @@ void HelpMain(const char* arg)
 	if ( arg && strlen(arg) > 0 )
 	{
 		if ( arg[0] == '-' )
+		{
 			arg++;
+		}
+
+		if ( strcmp(arg, "all") == 0 )
+		{
+			HelpOptions("Stages", 0, terminalColumns, stages, sizeof(stages)/sizeof(struct HelpOption));
 
-		unsigned i;
-		for ( i = 0; i < sizeof(stages)/sizeof(struct HelpOption); i++ )
+			for ( unsigned i = 0; i < sizeof(stages)/sizeof(struct HelpOption); i++ )
+			{
+				help_funcs[i]();
+			}
+			return;
+		}
+
+		for ( unsigned i = 0; i < sizeof(stages)/sizeof(struct HelpOption); i++ )
+		{
 			if ( strcmp(arg, stages[i].name+1) == 0 )
 			{
 				help_funcs[i]();
 				return;
 			}
+		}
 	}
 
 	HelpOptions("Stages", 0, terminalColumns, stages, sizeof(stages)/sizeof(struct HelpOption));