* Correct command-line handling

This commit is contained in:
Michaël Van Canneyt 2023-06-01 17:41:50 +02:00
parent 6e324989eb
commit bcdd3cd84b

View File

@ -85,7 +85,7 @@ function TSkelEngine.CreateElement(AClass: TPTreeElement; const AName: String;
begin begin
Result:=Assigned(AParent) and (Length(AName) > 0) and Result:=Assigned(AParent) and (Length(AName) > 0) and
(not DisableArguments or (APasElement.ClassType <> TPasArgument)) and (not DisableArguments or ((APasElement.ClassType <> TPasArgument) and (not (aParent is TPasArgument)))) and
(not DisableFunctionResults or (APasElement.ClassType <> TPasResultElement)) and (not DisableFunctionResults or (APasElement.ClassType <> TPasResultElement)) and
(not DisablePrivate or (AVisibility<>visPrivate)) and (not DisablePrivate or (AVisibility<>visPrivate)) and
(not DisableProtected or (AVisibility<>visProtected)); (not DisableProtected or (AVisibility<>visProtected));
@ -109,14 +109,26 @@ begin
Writeln(' --disable-arguments Do not check function arguments.'); Writeln(' --disable-arguments Do not check function arguments.');
Writeln(' --disable-private Do not check class private fields.'); Writeln(' --disable-private Do not check class private fields.');
Writeln(' --disable-protected Do not check class protected fields.'); Writeln(' --disable-protected Do not check class protected fields.');
Writeln(' --input=cmdline Input file to create skeleton for.'); Writeln(' --input=cmdline Input file to create skeleton for. Specify twice, once for each file.');
Writeln(' Use options are as for compiler.'); Writeln(' Use options as for compiler.');
Writeln(' --lang=language Use selected language.'); Writeln(' --lang=language Use selected language.');
Writeln(' --list List identifiers instead of making a diff'); Writeln(' --list List identifiers instead of making a diff');
Writeln(' --output=filename Send output to file.'); Writeln(' --output=filename Send output to file.');
Writeln(' --sparse Sparse list/diff (skip type identification)'); Writeln(' --sparse Sparse list/diff (skip type identification)');
end; end;
function setinput(const cmd : string) : Boolean;
begin
Result:=True;
if (InputFile1='') then
InputFile1:=Cmd
else if (InputFile2='') then
InputFile2:=Cmd
else
Result:=false;
end;
procedure ParseOption(const s: String); procedure ParseOption(const s: String);
var var
@ -153,14 +165,15 @@ begin
DocLang := Arg DocLang := Arg
else if (Cmd = '-o') or (Cmd = '--output') then else if (Cmd = '-o') or (Cmd = '--output') then
OutputName := Arg OutputName := Arg
else if (Cmd = '-i') or (Cmd = '--input') then
begin
if not SetInput(Arg) then
WriteLn(StdErr, Format(SCmdLineInvalidOption, [s]));
end
else else
if (length(cmd)>0) and (cmd[1]='-') then if (length(cmd)>0) and (cmd[1]='-') then
WriteLn(StdErr, Format(SCmdLineInvalidOption, [s])) WriteLn(StdErr, Format(SCmdLineInvalidOption, [s]))
else if (InputFile1='') then else if not SetInput(cmd) then
InputFile1:=Cmd
else if (InputFile2='') then
InputFile2:=Cmd
else
WriteLn(StdErr, Format(SCmdLineInvalidOption, [s])); WriteLn(StdErr, Format(SCmdLineInvalidOption, [s]));
end; end;
end; end;