hedgewars/ArgParsers.pas
changeset 13536 282218ab1b28
parent 13511 36f3f77e9b1b
child 13633 d5e029b84e16
--- a/hedgewars/ArgParsers.pas	Sat Jul 21 02:19:32 2018 +0300
+++ b/hedgewars/ArgParsers.pas	Fri Jul 20 20:00:52 2018 -0400
@@ -34,6 +34,7 @@
 implementation
 uses uVariables, uTypes, uUtils, uSound, uConsts;
 var isInternal: Boolean;
+    helpCommandUsed: Boolean;
 
 {$IFDEF HWLIBRARY}
 
@@ -100,8 +101,9 @@
     WriteLn(stdout, ' --help');
     WriteLn(stdout, '');
     WriteLn(stdout, 'For more detailed help and examples go to:');
-    WriteLn(stdout, 'http://hedgewars.org/kb/CommandLineOptions');
-    GameType:= gmtSyntax;
+    WriteLn(stdout, 'https://hedgewars.org/kb/CommandLineOptions');
+    GameType:= gmtSyntaxHelp;
+    helpCommandUsed:= true;
 end;
 
 procedure setDepth(var paramIndex: LongInt);
@@ -357,12 +359,13 @@
         inc(paramIndex);
         end;
     if wrongParameter = true then
-        GameType:= gmtSyntax;
+        GameType:= gmtBadSyntax;
 end;
 
 procedure GetParams;
 begin
     isInternal:= (ParamStr(1) = '--internal');
+    helpCommandUsed:= false;
 
     UserPathPrefix := _S'.';
     PathPrefix     := cDefaultPathPrefix;
@@ -372,18 +375,19 @@
     if (isInternal) and (ParamCount<=1) then
         begin
         WriteLn(stderr, '--internal should not be manually used');
-        GameType := gmtSyntax;
+        GameType := gmtBadSyntax;
         end;
 
-    if (not cTestLua) and (not isInternal) and (recordFileName = '') then
-        begin
-        WriteLn(stderr, 'You must specify a replay file');
-        GameType := gmtSyntax;
-        end
-    else if (recordFileName <> '') then
-        WriteLn(stdout, 'Attempting to play demo file "' + recordFilename + '"');
+    if (not helpCommandUsed) then
+        if (not cTestLua) and (not isInternal) and (recordFileName = '') then
+            begin
+            WriteLn(stderr, 'You must specify a replay file');
+            GameType := gmtBadSyntax;
+            end
+        else if (recordFileName <> '') then
+            WriteLn(stdout, 'Attempting to play demo file "' + recordFilename + '"');
 
-    if (GameType = gmtSyntax) then
+    if (GameType = gmtBadSyntax) then
         WriteLn(stderr, 'Please use --help to see possible arguments and their usage');
 
     (*