Check if a CLA has been defined.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(command_line_arguments_group), | intent(in) | :: | self |
CLAsG data. |
||
character(len=*), | intent(in) | :: | switch |
Switch name. |
||
integer(kind=I4P), | intent(out), | optional | :: | pos |
CLA position. |
Check if a CLA has been defined.
function is_defined(self, switch, pos) !< Check if a CLA has been defined. class(command_line_arguments_group), intent(in) :: self !< CLAsG data. character(*), intent(in) :: switch !< Switch name. integer(I4P), optional, intent(out) :: pos !< CLA position. logical :: is_defined !< Check if a CLA has been defined. integer(I4P) :: a !< CLA counter. is_defined = .false. if (present(pos)) pos = 0 if (self%Na>0) then do a=1, self%Na if (.not.self%cla(a)%is_positional) then if ((self%cla(a)%switch==switch).or.(self%cla(a)%switch_ab==switch)) then is_defined = .true. if (present(pos)) pos = a exit endif endif enddo endif endfunction is_defined