Read a value as a string_type.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cli_t), | intent(in) | :: | this | |||
| character(len=*), | intent(in) | :: | name |
Long name of a declared entry. |
||
| type(string_type), | intent(out) | :: | value |
The last value given, or the declared default. |
||
| type(error_t), | intent(inout), | optional | :: | err |
Set to |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer(kind=default_int), | private | :: | idx |
subroutine cli_get_string(this, name, value, err) !! Read a value as a `string_type`. class(cli_t), intent(in) :: this character(len=*), intent(in) :: name !! Long name of a declared entry. type(string_type), intent(out) :: value !! The last value given, or the declared default. type(error_t), intent(inout), optional :: err !! Set to `ERROR_VALIDATION` when `name` was never declared. integer(default_int) :: idx value = "" idx = this%find(name) if (idx == 0_default_int) then call fail(err, ERROR_VALIDATION, "pic_cli: no such option "//name) return end if value = this%entries(idx)%value end subroutine cli_get_string