Unit CastleParameters
Description
Processing command-line parameters and options (TParameters, single instance Parameters).
Uses
Overview
Classes, Interfaces, Objects and Records
Functions and Procedures
Types
Constants
Variables
Description
Functions and Procedures
function SeparateArgsToVector3Single(const v: TSeparateArgs): TVector3; deprecated 'use SeparateArgsToVector3'; |
Warning: this symbol is deprecated: use SeparateArgsToVector3 |
function OptionDescription(const Name, Description: string): string; |
Return a multiline command-line option help, containing the option name and description, nicely indented and broken into multiple lines. Existing newlines in Description are correctly accounted for.
|
Types
TOptionArgument = (...); |
Values
-
oaNone: No arguments allowed.
-
oaOptional: An optional argument. It must be given as --option=argument or (short form) -o=argument.
If you use a short form and you combine many short option names into one parameter, then only the last option may have an argument. For example -abc=blah is equivalent to -a -b -c=blah .
-
oaRequired: A required argument. It must be given as for oaOptional, but this time the equal sign is not needed (we know anyway that following parameter must be an argument). So the following versions are possible:
--option=argument # long form, as one parameter
--option argument # long form, as two parameters
-o=argument # short form, as one parameter
-o argument # short form, as two parameters
-
oaRequired2Separate: We require a specified (more than one) argument. All of the arguments must be specified as separate parameters, like
--option Argument1 Argument2
-o Argument1 Argument2
-
oaRequired3Separate
-
oaRequired4Separate
-
oaRequired5Separate
-
oaRequired6Separate
-
oaRequired7Separate
-
oaRequired8Separate
-
oaRequired9Separate
|
TOptionProc = procedure (OptionNum: Integer; HasArgument: boolean; const Argument: string; const SeparateArgs: TSeparateArgs; Data: Pointer); |
Callback used by TParameters.Parse to notify about new option.
Parameters
- OptionNum
- The option number in the Options table (zero-based).
- HasArgument
- Says if you have a single argument in the Argument parameter. Always
False when your option has oaNone or oaRequiredXSeparate. Always True when your option has oaRequired. For oaOptional, this is how you know if the optional argument was used.
- Argument
- A single argument for oaRequired or oaOptional, only if HasArgument. Otherwise empty string.
- SeparateArgs
- For options using oaRequiredXSeparate, your arguments are here. You get exactly as many argument as your oaRequiredXSeparate requested, the rest of SeparateArgs is empty strings.
- Data
- This is the OptionProcData value you passed to TParameters.Parse, use this to pass some pointer to your callback.
|
Constants
RequiredSeparateFirstCount = 2; |
|
EmptySeparateArgs: TSeparateArgs = ('','','', '','','', '','',''); |
|
OnlyHelpOptions: array[0..0]of TOption = (
(Short: 'h'; Long: 'help'; Argument: oaNone)
); |
|
HelpOptionHelp =
' -h / --help Print this help message and exit.'; |
|
VersionOptionHelp =
' -v / --version Print the version number and exit.'; |
|
Variables
Parameters: TParameters; |
Command-line parameters. Initialized from standard ParamStr(0) ... ParamStr(ParamCount). Can be later modified, which is good — you can remove handled parameters. You also have all the methods of TCastleStringList class (e.g. you can assign to another TCastleStringList instance).
|
Generated by PasDoc 0.16.0.