cli_occurrences Function

private pure function cli_occurrences(this, name) result(n)

How many times name appeared on the command line.

get returns the last occurrence. This is how a program that wants to reject or warn about a repeat can find out about one.

Type Bound

cli_t

Arguments

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

Long name to look for.

Return Value integer(kind=default_int)


Calls

proc~~cli_occurrences~~CallsGraph proc~cli_occurrences cli_t%cli_occurrences proc~cli_find cli_t%cli_find proc~cli_occurrences->proc~cli_find

Variables

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

Source Code

   pure function cli_occurrences(this, name) result(n)
      !! How many times `name` appeared on the command line.
      !!
      !! `get` returns the last occurrence. This is how a program that wants
      !! to reject or warn about a repeat can find out about one.
      class(cli_t), intent(in) :: this
      character(len=*), intent(in) :: name
         !! Long name to look for.
      integer(default_int) :: n

      integer(default_int) :: idx

      n = 0_default_int
      idx = this%find(name)
      if (idx > 0_default_int) n = this%entries(idx)%seen
   end function cli_occurrences