Get correct CLAsG usage.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(command_line_arguments_group), | intent(in) | :: | self |
CLAsG data. |
||
character(len=*), | intent(in), | optional | :: | pref |
Prefixing string. |
|
logical, | intent(in), | optional | :: | no_header |
Avoid insert header to usage. |
|
logical, | intent(in), | optional | :: | markdown |
Format things form markdown. |
Usage string.
function usage(self, pref, no_header, markdown) !< Get correct CLAsG usage. class(command_line_arguments_group), intent(in) :: self !< CLAsG data. character(*), optional, intent(in) :: pref !< Prefixing string. logical, optional, intent(in) :: no_header !< Avoid insert header to usage. logical, optional, intent(in) :: markdown !< Format things form markdown. character(len=:), allocatable :: usage !< Usage string. integer(I4P) :: a !< Counters. character(len=:), allocatable :: prefd !< Prefixing string. logical :: markdownd !< Markdonw format, local variable. markdownd = .false. ; if (present(markdown)) markdownd = markdown prefd = '' ; if (present(pref)) prefd = pref usage = self%progname ; if (self%group/='') usage = self%progname//' '//self%group usage = prefd//self%help//' '//usage//self%signature() if (self%description/='') usage = usage//new_line('a')//new_line('a')//prefd//self%description if (present(no_header)) then if (no_header) usage = '' endif if (self%Na_required>0) then usage = usage//new_line('a')//new_line('a')//prefd//'Required switches:' if(markdownd)usage = usage//' ' do a=1, self%Na if (self%cla(a)%is_required.and.(.not.self%cla(a)%is_hidden)) usage = usage//new_line('a')//& self%cla(a)%usage(pref=prefd,markdown=markdownd) enddo endif if (self%Na_optional>0) then usage = usage//new_line('a')//new_line('a')//prefd//'Optional switches:' if(markdownd)usage = usage//' ' do a=1, self%Na if (.not.self%cla(a)%is_required.and.(.not.self%cla(a)%is_hidden)) usage = usage//new_line('a')//& self%cla(a)%usage(pref=prefd,markdown=markdownd) enddo endif endfunction usage