49 lines
1.0 KiB
ObjectPascal
49 lines
1.0 KiB
ObjectPascal
unit CommandLine;
|
|
|
|
interface
|
|
|
|
uses 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 := CmdLine; // Utf8String(CmdLine);
|
|
CreateFromTemplate := false;
|
|
if Regex.Match then
|
|
if Regex.GroupCount = 2 then begin
|
|
CreateFromTemplate := true;
|
|
TemplateFile := Regex.Groups[1];
|
|
TemplateName := Regex.Groups[2];
|
|
end;
|
|
Regex.Destroy;
|
|
|
|
{ // AV: this is not so useful since NXFORMS still equals to 100
|
|
Regex := TPerlRegEx.Create;
|
|
Regex.RegEx := '-lite';
|
|
Regex.Options := [preSingleLine, preCaseless];
|
|
Regex.Subject := CmdLine; // Utf8String(CmdLine);
|
|
CreateFromTemplate := false;
|
|
if Regex.Match then
|
|
Lite := true;
|
|
Regex.Destroy;
|
|
}
|
|
end;
|
|
|
|
end.
|