Public class to store and parse command-line arguments.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(arg_class), | intent(inout) | :: | this | |||
character(len=*), | intent(in), | optional | :: | name | ||
character(len=1), | intent(in), | optional | :: | short | ||
integer, | intent(in), | optional | :: | type | ||
integer, | intent(in), | optional | :: | max_len | ||
integer, | intent(in), | optional | :: | min_len | ||
logical, | intent(in), | optional | :: | required | ||
integer, | intent(out), | optional | :: | error |
Initialises arg object and adds default arguments --help
and
--version
if default
is not .false.
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(arg_class), | intent(inout) | :: | this |
Arg object. |
||
integer, | intent(in), | optional | :: | max_size |
Max. number of arguments to expect. |
|
logical, | intent(in), | optional | :: | default |
Add default arguments. |
Destroys arg object.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(arg_class), | intent(inout) | :: | this |
Arg object. |
Returns argument value as 4-byte integer.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(arg_class), | intent(inout) | :: | this |
Arg object. |
||
character(len=*), | intent(in) | :: | name |
Argument name. |
||
integer, | intent(inout) | :: | value |
Argument value. |
||
integer, | intent(in), | optional | :: | default |
Default value. |
|
logical, | intent(out), | optional | :: | passed |
Passed or not. |
|
integer, | intent(out), | optional | :: | error |
Argument error. |
Returns .true.
if argument has been passed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(arg_class), | intent(inout) | :: | this |
Arg object. |
||
character(len=*), | intent(in) | :: | name |
Argument name. |
||
logical, | intent(inout) | :: | value |
Argument value. |
||
logical, | intent(in), | optional | :: | default |
Default value. |
|
logical, | intent(out), | optional | :: | passed |
Passed or not. |
|
integer, | intent(out), | optional | :: | error |
Argument error. |
Returns argument value as 8-byte real.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(arg_class), | intent(inout) | :: | this |
Arg object. |
||
character(len=*), | intent(in) | :: | name |
Argument name. |
||
real(kind=r8), | intent(inout) | :: | value |
Argument value. |
||
real(kind=r8), | intent(in), | optional | :: | default |
Default value. |
|
logical, | intent(out), | optional | :: | passed |
Passed or not. |
|
integer, | intent(out), | optional | :: | error |
Argument error. |
Returns argument value as character string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(arg_class), | intent(inout) | :: | this |
Arg object. |
||
character(len=*), | intent(in) | :: | name |
Argument name. |
||
character(len=*), | intent(inout) | :: | value |
Argument value. |
||
character(len=*), | intent(in), | optional | :: | default |
Default value. |
|
logical, | intent(out), | optional | :: | passed |
Passed or not. |
|
integer, | intent(out), | optional | :: | error |
Argument error. |
Returns .true.
if argument in arguments array has been passed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(arg_class), | intent(inout) | :: | this |
Arg object. |
||
character(len=*), | intent(in) | :: | name |
Argument name. |
Reads all arguments from command-line and prints error message if one is missing. Returns the error code of the first invalid argument.
The function also parses the command-line arguments for
-v
/--version
to display the current application and library
version, and -h
/--help
to output all available command-line
arguments. If one of these arguments is passed, dm_stop(0)
is
called afterwards.
Optional argument callback
is a routine that outputs the
version information.
The function returns the following error codes:
E_EMPTY
if array of arguments is empty.E_ARG_INVALID
if an required argument has not been passed.E_ARG_NO_VALUE
if an argument has been passed without value.E_ARG_TYPE
if an argument has the wrong type.E_ARG_LENGTH
if the length of the argument is wrong.E_ARG_UNKNOWN
if an unknown argument has been passed.Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(arg_class), | intent(inout) | :: | this |
Arg object. |
||
procedure(dm_arg_version_callback), | optional | :: | callback |
Version callback. |