Get CLA multiple values from CLAs list parsed with varying size list, integer(I4P).
Note
The CLA list is returned deallocated if values are not correctly gotten.
Note
For logical type CLA the value is directly read without any robust error trapping.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(command_line_interface), | intent(inout) | :: | self |
CLI data. |
||
integer(kind=I4P), | intent(out), | allocatable | :: | val(:) |
CLA values. |
|
character(len=*), | intent(in), | optional | :: | pref |
Prefixing string. |
|
character(len=*), | intent(in), | optional | :: | args |
String containing command line arguments. |
|
character(len=*), | intent(in), | optional | :: | group |
Name of group (command) of CLA. |
|
character(len=*), | intent(in), | optional | :: | switch |
Switch name. |
|
integer(kind=I4P), | intent(in), | optional | :: | position |
Position of positional CLA. |
|
integer(kind=I4P), | intent(out), | optional | :: | error |
Error trapping flag. |
subroutine get_cla_list_varying_I4P(self, val, pref, args, group, switch, position, error) !< Get CLA multiple values from CLAs list parsed with varying size list, integer(I4P). !< !< @note The CLA list is returned deallocated if values are not correctly gotten. !< !< @note For logical type CLA the value is directly read without any robust error trapping. class(command_line_interface), intent(inout) :: self !< CLI data. integer(I4P), allocatable, intent(out) :: val(:) !< CLA values. character(*), optional, intent(in) :: pref !< Prefixing string. character(*), optional, intent(in) :: args !< String containing command line arguments. character(*), optional, intent(in) :: group !< Name of group (command) of CLA. character(*), optional, intent(in) :: switch !< Switch name. integer(I4P), optional, intent(in) :: position !< Position of positional CLA. integer(I4P), optional, intent(out) :: error !< Error trapping flag. logical :: found !< Flag for checking if CLA containing switch has been found. integer(I4P) :: g !< Group counter. integer(I4P) :: a !< Argument counter. if (.not.self%is_parsed_) then call self%parse(pref=pref, args=args, error=error) if (self%error>0.and.self%error_unknown_clas/=ERROR_UNKNOWN_CLAS_IGNORED) return endif if (present(group)) then if (.not.self%is_defined_group(group=group, g=g)) then call self%errored(pref=pref, error=ERROR_MISSING_GROUP, group=group) endif else g = 0 endif if (present(switch)) then ! search for the CLA corresponding to switch found = .false. do a=1, self%clasg(g)%Na if (.not.self%clasg(g)%cla(a)%is_positional) then if ((self%clasg(g)%cla(a)%switch==switch).or.(self%clasg(g)%cla(a)%switch_ab==switch)) then found = .true. exit endif endif enddo if (.not.found) then call self%errored(pref=pref, error=ERROR_MISSING_CLA, switch=switch) else call self%clasg(g)%cla(a)%get_varying(pref=pref, val=val) ; self%error = self%clasg(g)%cla(a)%error endif elseif (present(position)) then call self%clasg(g)%cla(position)%get_varying(pref=pref, val=val) ; self%error = error else call self%errored(pref=pref, error=ERROR_MISSING_SELECTION_CLA) endif ! check if the only error found is for unknown passed CLAs and if it is ignored by the user if (self%error==ERROR_UNKNOWN.and.self%error_unknown_clas==ERROR_UNKNOWN_CLAS_IGNORED) self%error = ERROR_UNKNOWN_CLAS_IGNORED if (present(error)) error = self%error endsubroutine get_cla_list_varying_I4P