Simple Command Line Options Parser - spawned from the DUnitX Project.
For more information check out these blog posts :
Simple Command Line Options Parser - part of the DUnitX Project
License: Apache License 2.0
Simple Command Line Options Parser - spawned from the DUnitX Project.
For more information check out these blog posts :
When registering options in an initialization section, with a duplicate short name, this can cause a 217 runtime error due to an exception being raised before sysutils has initialized. Investigating.
Allow the user to implement his own validation implementation i.e. by implementing an OnValidation event as TValidationEvent = function(aOption: IOptionDefinition; const Value: string): boolean
Unnamed parameters should also have a name, so they can be explained in the usage string
When looking into #16 I found out that PrintUsage crashes when the description is empty
if opt.HasValue then
s := s + FNameValueSeparator + '<' + opt.LongName + '>';
if opt.AllowMultiple then
s := s + ' +'
else
s := s + ' ';
s := PadRight(s, FDescriptionTab);
--> s := s + descStrings[0]; <-- Exception occurs here
proc(s);
numDescStrings := Length(descStrings);
if numDescStrings > 1 then
begin
for i := 1 to numDescStrings -1 do
begin
s := PadLeft(descStrings[i], FDescriptionTab);
proc(s);
end;
proc('');
end;
The hidden attribute introduced in ac9c738 is no longer functional since a long time. It is still there, but never checked. I didn't try to find out in which commit it was removed.
In VSoft.CommandLine.OptionDef.pas
, under tkFloat:
in TOptionDefinition<T>.Invoke
, StrToFloat
is called, but StrToFloat
is locale specific.
This means that on most European machines, StrToFloat
will assume ',' as a decimal separator and not '.'. That might not work well for scripts that use a program using this command line parser.
Now, I cannot find a simple method like Str
(which for the reverse case always uses '.' as decimal separator, whereas FloatToStr
would always use the locale), so you need to supply a TFormatSettings
with DecimalSeparator
set to '.' as its second argument.
When registering an option it would be handy to be able to define a default value for the parameter, which will also be mentioned in the Usage: string
I just had a need to be able to register sets of options, which are context sensitive based on another option, e.g
mytool commandA [command A options]
mytool commandB [command B options]
Open to suggestions on how to implement this.
In the master branch in vsoft.commandline.options.pas
at line 348
the check if numDescStrings > 1
is probably wrong and the first option help text is never displayed in print usage.
Changing the check with if numDescStrings > 0
correctly works.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.