| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*) | :: | key |
logical function cla_key_present(key) implicit none character(len=STRLEN) :: arg character(len=*) :: key character(len=STRLEN) :: longkey character(len=2) :: shortkey character(len=STRLEN) :: value integer(kind=int_kind) :: ncla, k, kk ! integer :: cla_command_argument_count ! external cla_command_argument_count ! Loop over the command line arguments to assign to ! value. ! Note that no error is reported if the key was NOT ! registered, but it is present on the command line. cla_key_present = .false. ! write(*,*) 'Calling cla_key_present with key = ',trim(key) value = trim(cla_empty) do kk=1,cla_num ! must test for exact match, not just substring if (cla_key_arg_match(cla_registry(kk)%key, & cla_registry(kk)%longkey, & key))then value = trim(cla_registry(kk)%default) longkey = cla_registry(kk)%longkey shortkey = cla_registry(kk)%key exit end if end do if (index(trim(value),trim(cla_empty)) /= 0) then call cla_show call cla_fatal('Unknown command line argument: '//trim(key)) endif ncla = cla_command_argument_count() if (ncla == 0) return do k=1,ncla call cla_get_command_argument(k,arg) ! test for exact match if (cla_key_arg_match(shortkey,longkey,arg))then cla_key_present = .true. return endif enddo end function cla_key_present