|
◆ optionparser_add_c()
subroutine optionparser_add_c |
( |
type(optionparser), intent(inout) |
this, |
|
|
character(len=*), intent(in) |
short_opt, |
|
|
character(len=*), intent(in) |
long_opt, |
|
|
character(len=*), target |
dest, |
|
|
character(len=*), optional |
default, |
|
|
character(len=*), optional |
help, |
|
|
logical, intent(in), optional |
isopt |
|
) |
| |
Add a new option with a character type argument.
When parsing will be performed, if the requested option is encountered, its corresponding compulsory argument will be copied into the provided destination, truncating it if it is too long. An optional default value can be provided for the destination. Please use the generic optionparser_add method rather than this particular method. - Parametri
-
[in,out] | this | optionparser object |
[in] | short_opt | the short option (may be empty) |
[in] | long_opt | the long option (may be empty) |
| dest | the destination of the option parse result |
| default | the default value to give to dest if option is not found |
| help | the help message that will be formatted and pretty-printed on screen |
[in] | isopt | if provided and .TRUE. the argument is considered optional |
Definizione alla linea 1102 del file optionparser_class.F90.
1103 find_shortopt: DO j = 1, this%options%arraysize
1104 IF (this%options%array(j)%short_opt == arg(2:2)) THEN
1105 SELECT CASE(this%options%array(j)%need_arg)
1107 IF (len_trim(arg) > 2) THEN
1109 status = max(option_found(this%options%array(j), optarg), &
1112 IF (i < iargc()) THEN
1114 CALL getarg(i, optarg)
1115 status = max(option_found(this%options%array(j), optarg), &
1118 status = optionparser_err
1119 CALL l4f_log(l4f_error, &
1120 'in optionparser, option '''//trim(arg)// ''' requires an argument')
1124 IF (len_trim(arg) > 2) THEN
1127 IF (i < iargc()) THEN
1128 CALL getarg(i+1, optarg)
1129 IF (optarg(1:1) == '-') THEN
1138 status = max(option_found(this%options%array(j), optarg), &
|