IDE: --help parameter is detected at any position now

git-svn-id: trunk@32212 -
This commit is contained in:
maxim 2011-09-07 21:37:42 +00:00
parent 3fb87d479c
commit 326ec7dc44

View File

@ -59,7 +59,7 @@ procedure ParseCommandLine(aCmdLineParams : TStrings; out IDEPid : Integer;
function GetCommandLineParameters(aCmdLineParams : TStrings; function GetCommandLineParameters(aCmdLineParams : TStrings;
isStartLazarus : Boolean = False) : String; isStartLazarus : Boolean = False) : String;
function IsHelpRequested (index : Integer = 1) : Boolean; function IsHelpRequested : Boolean;
function IsVersionRequested : boolean; function IsVersionRequested : boolean;
function GetLanguageSpecified : string; function GetLanguageSpecified : string;
function ParamIsOption(ParamIndex : integer; const Option : string) : boolean; function ParamIsOption(ParamIndex : integer; const Option : string) : boolean;
@ -145,20 +145,27 @@ begin
Result := Result + ' ' + aCmdLineParams[i]; Result := Result + ' ' + aCmdLineParams[i];
end; end;
function IsHelpRequested (index : Integer = 1) : Boolean; function IsHelpRequested : Boolean;
var
i: integer;
begin begin
Result := (ParamCount>=index) and Result := false;
((SysUtils.CompareText (ParamStrUTF8(index), '--help') = 0) or i:=1;
(SysUtils.CompareText (ParamStrUTF8(index), '-help') = 0) or while (i <= ParamCount) and (Result = false) do
(SysUtils.CompareText (ParamStrUTF8(index), '-?') = 0) or begin
(SysUtils.CompareText (ParamStrUTF8(index), '-h') = 0)); Result := ParamIsOption(i, '--help') or
ParamIsOption(i, '-help') or
ParamIsOption(i, '-?') or
ParamIsOption(i, '-h');
inc(i);
end;
end; end;
function IsVersionRequested: boolean; function IsVersionRequested: boolean;
begin begin
Result := (ParamCount=1) and Result := (ParamCount=1) and
((SysUtils.CompareText (ParamStrUTF8(1), '--version') = 0) or (ParamIsOption(1, '--version') or
(SysUtils.CompareText (ParamStrUTF8(1), '-v') = 0)); ParamIsOption(1, '-v'));
end; end;
function GetLanguageSpecified : string; function GetLanguageSpecified : string;