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 | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cli_t), | intent(in) | :: | this | |||
| character(len=*), | intent(in) | :: | name |
Long name to look for. |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer(kind=default_int), | private | :: | idx |
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