up: ARG     index Zimbu documentation

CLASS ARG.Flag @abstract @earlyInit @public

summary

     

The abstract base class of all flags.

All flags must be created in EarlyInit() or earlier. Initializing them in a declaration at the module level or SHARED section in a class will work.

See the ARG module for examples.

$setArgName(argName) ARG.Flag @public  Set the text used in the --help output for the argument.
$disableCompact() ARG.Flag @public  Disable the compact form of flag values.
$optionalArg() ARG.Flag @public  Make the flag argument optional.
$presentCount() int @public  Return the number of times the command line flag was encountered.
$present() bool @public  Return TRUE if the command line flag was encountered.
 
Known subclasses:
     
 

members (alphabetically)

     

FUNC $disableCompact() ARG.Flag @public

     

Disable the compact form of flag values.

Compact form is giving a value to a flag without an "=". For example, when "-n" is a Int flag, "-n123" uses value "123".

The compact form is allowed by default. It can also be disabled for each individual flag.

Returns the Flag, so that it can be used in a declaration like this:

 ARG.String name = NEW("n", "name", "", "the name").disableCompact()

This must be invoked in EarlyInit() or earlier.

FUNC $optionalArg() ARG.Flag @public

     

Make the flag argument optional.

Returns the Flag, so that it can be used in a declaration like this:

 ARG.String name = NEW("n", "name", "", "the name").optionalArg()

Valid flags are then "-n" "-nfoobar", "-n=foobar", "--name=foobar".

This must be invoked in EarlyInit() or earlier.

FUNC $present() bool @public

     

Return TRUE if the command line flag was encountered.

Can only be used after EarlyInit(), when ARG.Ready is TRUE.

FUNC $presentCount() int @public

     

Return the number of times the command line flag was encountered.

Can only be used after EarlyInit(), when ARG.Ready is TRUE.

FUNC $setArgName(string argName) ARG.Flag @public

     

Set the text used in the --help output for the argument.

Not used for a Bool flag.

Returns the Flag, so that it can be used in a declaration like this:

 ARG.String name = NEW("n", "name", "", "the name").setArgName("name")

This must be invoked in EarlyInit() or earlier.

license

      Copyright 2009 Bram Moolenaar All Rights Reserved.

      Licensed under the Apache License, Version 2.0. See the LICENSE file or obtain a copy at: http://www.apache.org/licenses/LICENSE-2.0