comp • gb.args • args

Args (gb.args)

This class reimplements Args in gb.
This class is static.
This class acts like a
Returns the program argument specified by the Index parameter.
static array.
This class is
Enumerates all arguments passed to the application.
statically enumerable
with the FOR EACH keyword.

Static properties

Static methods
Return a copy of the process arguments as a string array.
Return the number of command line arguments.
Returns Args.Count - 1
Start the program argument analysis.
Terminate the program argument analysis, and return all arguments that could not be interpreted as an option or an option argument.
Define an option that takes one string argument, and return it.
Define an option that takes one floating point number argument, and return it.
Define an option that takes one integer number argument, and return it.
Define an option that takes no argument, and return if it has been specified.

This class analyses the arguments of the current process.

It allows you to:

  • Extract options from the program arguments.

  • Automatically handle --version and --help options.

  • Return non-options as arguments.

Use the Begin method to start the option analysis and the End method to terminate it.

This class will automatically print help, usage and version messages to the standard output.

Since 3.15.90

If you use Args.Has() to check for -V --version or -h --help manually then the default output will be suppressed.

This is useful to display your own custom help or version message.

Args.HelpText() can be used to get or print the original help text if you are handling the -h manually but it can ONLY be called AFTER calling Args.Begin.

If an error occurs, the program quits with the exit code 1.