浏览代码

pas2js: compileserver: added commandline param --version

mattias 3 年之前
父节点
当前提交
d76cfdd913
共有 1 个文件被更改,包括 10 次插入4 次删除
  1. 10 4
      utils/pas2js/httpcompiler.pp

+ 10 - 4
utils/pas2js/httpcompiler.pp

@@ -12,8 +12,8 @@ uses
   Pas2JSCompilerCfg, ssockets;
   Pas2JSCompilerCfg, ssockets;
 
 
 Const
 Const
+  HTTPCompilerVersion = '1.0';
   nErrTooManyThreads = -1;
   nErrTooManyThreads = -1;
-
   nExitCodeSocketError = 1;
   nExitCodeSocketError = 1;
 
 
 Type
 Type
@@ -53,7 +53,6 @@ Type
      Property Compiles[AIndex : Integer] : TCompileItem Read GetC; default;
      Property Compiles[AIndex : Integer] : TCompileItem Read GetC; default;
   end;
   end;
 
 
-
   { TCompileThread }
   { TCompileThread }
 
 
   TCompileThread = class(TThread)
   TCompileThread = class(TThread)
@@ -277,6 +276,7 @@ begin
   {AllowWriteln}
   {AllowWriteln}
   if (Msg<>'') then
   if (Msg<>'') then
     Writeln('Error: ',Msg);
     Writeln('Error: ',Msg);
+  Writeln('Version ',HTTPCompilerVersion);
   Writeln('Usage ',ExtractFileName(ParamStr(0)),' [options] ');
   Writeln('Usage ',ExtractFileName(ParamStr(0)),' [options] ');
   Writeln('Where options is one or more of : ');
   Writeln('Where options is one or more of : ');
   Writeln('-A --api=location,secret Enable location management API.');
   Writeln('-A --api=location,secret Enable location management API.');
@@ -768,9 +768,15 @@ Var
   S : String;
   S : String;
 
 
 begin
 begin
-  S:=Checkoptions('shqd:ni:p:wP::cm:A:I:',['help','quiet','noindexpage','directory:','port:','indexpage:','watch','project::','config:','simpleserver','mimetypes:','api:','interface:']);
+  S:=Checkoptions('shqVd:ni:p:wP::cm:A:I:',['help','quiet','version','noindexpage','directory:','port:','indexpage:','watch','project::','config:','simpleserver','mimetypes:','api:','interface:']);
   if (S<>'') or HasOption('h','help') then
   if (S<>'') or HasOption('h','help') then
-    usage(S);
+    Usage(S);
+  if HasOption('V','version') then
+    begin
+    writeln(HTTPCompilerVersion);
+    Terminate;
+    exit;
+    end;
   if HasOption('c','config') then
   if HasOption('c','config') then
     ConfigFile:=GetOptionValue('c','config')
     ConfigFile:=GetOptionValue('c','config')
   else
   else