Get the argument indexes of CLAs groups defined parsing the actual passed CLAs.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(command_line_interface), | intent(inout) | :: | self |
CLI data. |
||
integer(kind=I4P), | intent(out), | allocatable | :: | ai(:,:) |
CLAs grouped indexes. |
subroutine get_clasg_indexes(self, ai) !< Get the argument indexes of CLAs groups defined parsing the actual passed CLAs. class(command_line_interface), intent(inout) :: self !< CLI data. integer(I4P), allocatable, intent(out) :: ai(:,:)!< CLAs grouped indexes. integer(I4P) :: Na !< Number of command line arguments passed. integer(I4P) :: a !< Counter for CLAs. integer(I4P) :: aa !< Counter for CLAs. integer(I4P) :: g !< Counter for CLAs group. logical :: found !< Flag for inquiring if a named group is found. allocate(ai(0:size(self%clasg,dim=1)-1,1:2)) ai = 0 if (allocated(self%args)) then Na = size(self%args,dim=1) a = 0 found = .false. search_named: do while(a<Na) a = a + 1 if (self%is_defined_group(group=trim(self%args(a)), g=g)) then found = .true. self%clasg(g)%is_called = .true. ai(g,1) = a + 1 aa = a do while(aa<Na) aa = aa + 1 if (self%is_defined_group(group=trim(self%args(aa)))) then a = aa - 1 ai(g,2) = a exit else ai(g,2) = aa endif enddo elseif (.not.found) then ai(0,2) = a endif enddo search_named if (ai(0,2)>0) then ai(0,1) = 1 self%clasg(0)%is_called = .true. elseif (all(ai==0)) then self%clasg(0)%is_called = .true. endif else self%clasg(0)%is_called = .true. endif endsubroutine get_clasg_indexes