@@ -19,10 +19,11 @@ interface
1919
2020const
2121 PASBUILD_VERSION = { $I version.inc} ;
22+ PASBUILD_BUILD_DATE = { $I %DATE%} ;
2223
2324type
2425 { Valid build goals }
25- TBuildGoal = (bgUnknown, bgClean, bgProcessResources, bgCompile, bgProcessTestResources, bgTestCompile, bgTest, bgPackage, bgSourcePackage, bgInstall, bgInit, bgHelp, bgVersion);
26+ TBuildGoal = (bgUnknown, bgClean, bgProcessResources, bgCompile, bgProcessTestResources, bgTestCompile, bgTest, bgPackage, bgSourcePackage, bgInstall, bgInit, bgHelp, bgVersion, bgLicense );
2627
2728 { Parsed command-line arguments }
2829 TCommandLineArgs = record
@@ -33,6 +34,7 @@ TCommandLineArgs = record
3334 FPCExecutable: string; // Custom FPC compiler path (empty = default 'fpc')
3435 ShowHelp: Boolean;
3536 ShowVersion: Boolean;
37+ ShowLicense: Boolean;
3638 Verbose: Boolean;
3739 ErrorMessage: string;
3840 end ;
@@ -46,6 +48,7 @@ TArgumentParser = class
4648 class function ParseArguments : TCommandLineArgs;
4749 class procedure ShowHelp ;
4850 class procedure ShowVersion ;
51+ class procedure ShowLicense ;
4952 end ;
5053
5154implementation
@@ -85,6 +88,8 @@ class function TArgumentParser.GoalFromString(const AGoalStr: string): TBuildGoa
8588 Result := bgHelp
8689 else if GoalLower = ' --version' then
8790 Result := bgVersion
91+ else if GoalLower = ' --license' then
92+ Result := bgLicense
8893 else
8994 Result := bgUnknown;
9095end ;
@@ -104,6 +109,7 @@ class function TArgumentParser.GoalToString(AGoal: TBuildGoal): string;
104109 bgInit: Result := ' init' ;
105110 bgHelp: Result := ' --help' ;
106111 bgVersion: Result := ' --version' ;
112+ bgLicense: Result := ' --license' ;
107113 else Result := ' unknown' ;
108114 end ;
109115end ;
@@ -123,6 +129,7 @@ class function TArgumentParser.ParseArguments: TCommandLineArgs;
123129 Result.FPCExecutable := ' ' ; // Default: use 'fpc' from PATH
124130 Result.ShowHelp := False;
125131 Result.ShowVersion := False;
132+ Result.ShowLicense := False;
126133 Result.Verbose := False;
127134 Result.ErrorMessage := ' ' ;
128135
@@ -163,6 +170,12 @@ class function TArgumentParser.ParseArguments: TCommandLineArgs;
163170 Exit;
164171 end ;
165172
173+ if Result.Goal = bgLicense then
174+ begin
175+ Result.ShowLicense := True;
176+ Exit;
177+ end ;
178+
166179 // Validate goal
167180 if Result.Goal = bgUnknown then
168181 begin
@@ -262,6 +275,7 @@ class procedure TArgumentParser.ShowHelp;
262275 WriteLn(' -v, --verbose Show full compiler output' );
263276 WriteLn(' -h, --help Show this help message' );
264277 WriteLn(' --version Show version information' );
278+ WriteLn(' --license Show license information' );
265279 WriteLn;
266280 WriteLn(' Examples:' );
267281 WriteLn(' pasbuild compile # Build with default settings' );
@@ -283,6 +297,8 @@ class procedure TArgumentParser.ShowVersion;
283297begin
284298 WriteLn(' PasBuild version ' , PASBUILD_VERSION);
285299 WriteLn(' Build automation tool for Free Pascal projects' );
300+ WriteLn(' Built: ' , PASBUILD_BUILD_DATE);
301+ WriteLn(' Author: Graeme Geldenhuys' );
286302 WriteLn;
287303
288304 // Show which FPC is being used and its version
@@ -291,4 +307,37 @@ class procedure TArgumentParser.ShowVersion;
291307 WriteLn;
292308end ;
293309
310+ class procedure TArgumentParser.ShowLicense ;
311+ begin
312+ WriteLn(' BSD 3-Clause License' );
313+ WriteLn;
314+ WriteLn(' Copyright (c) 2025 - Graeme Geldenhuys <graemeg@gmail.com>' );
315+ WriteLn;
316+ WriteLn(' Redistribution and use in source and binary forms, with or without' );
317+ WriteLn(' modification, are permitted provided that the following conditions are met:' );
318+ WriteLn;
319+ WriteLn(' 1. Redistributions of source code must retain the above copyright notice, this' );
320+ WriteLn(' list of conditions and the following disclaimer.' );
321+ WriteLn;
322+ WriteLn(' 2. Redistributions in binary form must reproduce the above copyright notice,' );
323+ WriteLn(' this list of conditions and the following disclaimer in the documentation' );
324+ WriteLn(' and/or other materials provided with the distribution.' );
325+ WriteLn;
326+ WriteLn(' 3. Neither the name of the copyright holder nor the names of its' );
327+ WriteLn(' contributors may be used to endorse or promote products derived from' );
328+ WriteLn(' this software without specific prior written permission.' );
329+ WriteLn;
330+ WriteLn(' THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"' );
331+ WriteLn(' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE' );
332+ WriteLn(' IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE' );
333+ WriteLn(' DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE' );
334+ WriteLn(' FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL' );
335+ WriteLn(' DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR' );
336+ WriteLn(' SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER' );
337+ WriteLn(' CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,' );
338+ WriteLn(' OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE' );
339+ WriteLn(' OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.' );
340+ WriteLn;
341+ end ;
342+
294343end .
0 commit comments