apophysis7x/IO/CommandLine.pas
xyrus02 95a2f54683 ADMIN: migration complete
git-svn-id: https://svn.code.sf.net/p/apophysis7x/svn/trunk@1 a5d1c0f9-a0e9-45c6-87dd-9d276e40c949
2013-07-28 08:58:33 +00:00

49 lines
1.1 KiB
ObjectPascal

unit CommandLine;
interface
uses Dialogs, RegularExpressionsCore;
type TCommandLine = class
public
CreateFromTemplate : boolean;
TemplateFile : string;
TemplateName : string;
Lite: boolean;
procedure Load;
end;
implementation
procedure TCommandLine.Load;
var
Regex: TPerlRegEx;
begin
Regex := TPerlRegEx.Create;
Regex.RegEx := '-template\s+"(.+)"\s+"(.+)"';
Regex.Options := [preSingleLine, preCaseless];
Regex.Subject := Utf8String(CmdLine);
CreateFromTemplate := false;
if Regex.Match then begin
if Regex.GroupCount = 2 then begin
CreateFromTemplate := true;
TemplateFile := String(Regex.Groups[1]);
TemplateName := String(Regex.Groups[2]);
end;
end;
Regex.Destroy;
Regex := TPerlRegEx.Create;
Regex.RegEx := '-lite';
Regex.Options := [preSingleLine, preCaseless];
Regex.Subject := Utf8String(CmdLine);
CreateFromTemplate := false;
if Regex.Match then begin
Lite := true;
end;
Regex.Destroy;
end;
end.