Prechádzať zdrojové kódy

* Implemented --descr-dir and --input-dir

git-svn-id: trunk@19755 -
michael 13 rokov pred
rodič
commit
293f20b26c
2 zmenil súbory, kde vykonal 38 pridanie a 0 odobranie
  1. 2 0
      utils/fpdoc/dglobals.pp
  2. 36 0
      utils/fpdoc/fpdoc.pp

+ 2 - 0
utils/fpdoc/dglobals.pp

@@ -153,6 +153,8 @@ resourcestring
   SUsageOption210 =  '--write-project=file Do not write documentation, create project file instead';
   SUsageOption220 =  '--verbose         Write more information on the screen';
   SUsageOption230 =  '--dry-run         Only parse sources and XML, do not create output';
+  SUsageOption240 =  '--descr-dir=Dir   Add All XML files in Dir to list of description files';
+  SUsageOption250 =  '--input-dir=Dir   Add All *.pp and *.pas files in Dir to list of input files';
 
   SUsageFormats        = 'The following output formats are supported by this fpdoc:';
   SUsageBackendHelp    = 'Specify an output format, combined with --help to get more help for this backend.';

+ 36 - 0
utils/fpdoc/fpdoc.pp

@@ -88,6 +88,8 @@ begin
   Writeln(SUsageOption210);
   Writeln(SUsageOption220);
   Writeln(SUsageOption230);
+  Writeln(SUsageOption240);
+  Writeln(SUsageOption250);
   L:=TStringList.Create;
   Try
     Backend:=FCreator.OPtions.Backend;
@@ -197,6 +199,33 @@ end;
 
 procedure TFPDocAplication.Parseoption(Const S : String);
 
+  procedure AddDirToFileList(List: TStrings; const ADirName, AMask: String);
+
+  Var
+    Info : TSearchRec;
+    D : String;
+
+  begin
+    if (ADirName<>'') and not DirectoryExists(ADirName) then
+       OutputLog(Self,'Directory '+ADirName+' does not exist')
+    else
+      begin
+      if (ADirName='.') or (ADirName='') then
+        D:=''
+      else
+        D:=IncludeTrailingPathDelimiter(ADirName);
+      If (FindFirst(D+AMask,0,Info)=0) then
+        try
+          Repeat
+            If (Info.Attr and faDirectory)=0 then
+              List.Add(D+Info.name);
+          Until FindNext(Info)<>0;
+        finally
+          FindClose(Info);
+        end;
+      end;
+  end;
+
   procedure AddToFileList(List: TStrings; const FileName: String);
   var
     f: Text;
@@ -253,6 +282,8 @@ begin
       end
     else if (Cmd = '--descr') then
       AddToFileList(SelectedPackage.Descriptions, Arg)
+    else if (Cmd = '--descr-dir') then
+      AddDirToFileList(SelectedPackage.Descriptions, Arg, '*.xml')
     else if (Cmd = '-f') or (Cmd = '--format') then
       begin
       Arg:=UpperCase(Arg);
@@ -265,6 +296,11 @@ begin
       FCreator.Options.Language := Arg
     else if (Cmd = '-i') or (Cmd = '--input') then
       AddToFileList(SelectedPackage.Inputs, Arg)
+    else if (Cmd = '--input-dir') then
+      begin
+      AddDirToFileList(SelectedPackage.Inputs, Arg,'*.pp');
+      AddDirToFileList(SelectedPackage.Inputs, Arg,'*.pas');
+      end
     else if (Cmd = '-o') or (Cmd = '--output') then
       SelectedPackage.Output := Arg
     else if (Cmd = '-v') or (Cmd = '--verbose') then