up: ARG     index Zimbu documentation

CLASS ARG.Int EXTENDS ARG.Flag @public

summary

     

A Flag that has one number argument.

For example, with this flag:

 ARG.Int retry = NEW("r", "retry", 3, "retry count")
These arguments can be used:
 prog --retry 20
 prog --retry=8
 prog -r 4
 prog -r1

By default the flag is not allowed to be used more than once. Use enableRepeat() to allow it.

NEW(shortName, longName, default, doc) @public  Create an Int Flag.
$enableRepeat() ARG.Int @public  Allow the flag to appear more than once.
$get() int @public  Return the value.
$value() int @public  Return the value.
$getList() list<int> @file  Return the list of values.
$valueList() list<int> @file  Return the list of values.
 
Inherited from ARG.Flag:
$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.
 

members (alphabetically)

     

PROC NEW(string shortName, string longName, int default, string doc) @public

     

Create an Int Flag.

shortName is the one-character name, can be NIL. longName is the longer name, to be used after "--", can be NIL shortName and longName can't both be NIL. default is the default value, used when the flag is not present. doc is displayed for this flag with the --help argument.

FUNC $enableRepeat() ARG.Int @public

     

Allow the flag to appear more than once.

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

 ARG.String name = NEW("n", "name", "", "the name").enableRepeat()
The value of the last flag will then be stored and can be obtained with get() and value(), getList() and valueList() return a list with all the values and presentCount() returns the number of times the flag appears.

This must be invoked in EarlyInit() or earlier.

FUNC $get() int @public

     

Return the value.

When the flag was not encountered it will be the specified default.

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

FUNC $getList() list<int> @file

     

Return the list of values.

When the flag was not encountered it will be an empty list Otherwise the list contains all the values encountered. When a flag doesn't have a value, the default value is used.

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

FUNC $value() int @public

     

Return the value.

When the flag was not encountered it will be the specified default.

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

FUNC $valueList() list<int> @file

     

Return the list of values.

When the flag was not encountered it will be an empty list Otherwise the list contains all the values encountered. When a flag doesn't have a value, the default value is used.

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

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