cli_find_short Function

private pure function cli_find_short(this, short) result(idx)

Index of the entry with this short name, or 0. Empty never matches.

Arguments

Type IntentOptional Attributes Name
class(cli_t), intent(in) :: this
character(len=*), intent(in) :: short

Return Value integer(kind=default_int)


Called by

proc~~cli_find_short~~CalledByGraph proc~cli_find_short cli_find_short proc~cli_parse_args cli_t%cli_parse_args proc~cli_parse_args->proc~cli_find_short proc~cli_parse cli_t%cli_parse proc~cli_parse->proc~cli_parse_args

Variables

Type Visibility Attributes Name Initial
integer(kind=default_int), private :: i

Source Code

   pure function cli_find_short(this, short) result(idx)
      !! Index of the entry with this short name, or 0. Empty never matches.
      class(cli_t), intent(in) :: this
      character(len=*), intent(in) :: short
      integer(default_int) :: idx

      integer(default_int) :: i

      idx = 0_default_int
      if (len(short) == 0) return
      do i = 1_default_int, this%count
         if (len(char(this%entries(i)%short)) == 0) cycle
         if (char(this%entries(i)%short) == short) then
            idx = i
            return
         end if
      end do
   end function cli_find_short