Skip to content

Commit 2a464d3

Browse files
committed
feat: Replace banner with fun tagline, add build date and --license flag
Condense the two-line banner into a single personality-driven line with compile-time build date. Move the BSD-3-Clause copyright notice to a dedicated --license flag. Enhance --version to show build date and author.
1 parent 25238b9 commit 2a464d3

File tree

2 files changed

+59
-4
lines changed

2 files changed

+59
-4
lines changed

src/main/pascal/PasBuild.CLI.pas

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ interface
1919

2020
const
2121
PASBUILD_VERSION = {$I version.inc};
22+
PASBUILD_BUILD_DATE = {$I %DATE%};
2223

2324
type
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

5154
implementation
@@ -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;
9095
end;
@@ -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;
109115
end;
@@ -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;
283297
begin
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;
292308
end;
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+
294343
end.

src/main/pascal/PasBuild.pas

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@
4949
ProjectDir, OriginalDir: string;
5050

5151
begin
52-
WriteLn('[INFO] PasBuild ', PASBUILD_VERSION);
53-
WriteLn('[INFO] Copyright (c) 2025 by Graeme Geldenhuys');
54-
WriteLn;
52+
WriteLn('[INFO] PasBuild ', PASBUILD_VERSION, ' — Born ', PASBUILD_BUILD_DATE, '. Raised by Graeme Geldenhuys.');
5553

5654
// Parse command line arguments
5755
Args := TArgumentParser.ParseArguments;
@@ -92,6 +90,14 @@
9290
Exit;
9391
end;
9492

93+
// Handle license
94+
if Args.ShowLicense then
95+
begin
96+
TArgumentParser.ShowLicense;
97+
ExitCode := 0;
98+
Exit;
99+
end;
100+
95101
// Resolve project file path and change to its directory.
96102
// This allows running pasbuild from any directory using -f flag,
97103
// e.g.: pasbuild compile -f ../../../project.xml

0 commit comments

Comments
 (0)