Add CLAs group to CLI.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(command_line_interface), | intent(inout) | :: | self |
CLI data. |
||
character(len=*), | intent(in), | optional | :: | help |
Help message. |
|
character(len=*), | intent(in), | optional | :: | description |
Detailed description. |
|
character(len=*), | intent(in), | optional | :: | exclude |
Group name of the mutually exclusive group. |
|
character(len=*), | intent(in), | optional | :: | examples(1:) |
Examples of correct usage of the group. |
|
character(len=*), | intent(in) | :: | group |
Name of the grouped CLAs. |
subroutine add_group(self, help, description, exclude, examples, group) !< Add CLAs group to CLI. class(command_line_interface), intent(inout) :: self !< CLI data. character(*), optional, intent(in) :: help !< Help message. character(*), optional, intent(in) :: description !< Detailed description. character(*), optional, intent(in) :: exclude !< Group name of the mutually exclusive group. character(*), optional, intent(in) :: examples(1:) !< Examples of correct usage of the group. character(*), intent(in) :: group !< Name of the grouped CLAs. type(command_line_arguments_group), allocatable :: clasg_list_new(:) !< New (extended) CLAs group list. character(len=:), allocatable :: helpd !< Help message. character(len=:), allocatable :: descriptiond !< Detailed description. character(len=:), allocatable :: excluded !< Group name of the mutually exclusive group. integer(I4P) :: Ng !< Number of groups. integer(I4P) :: gi !< Group index if (.not.self%is_defined_group(group=group)) then helpd = 'usage: ' ; if (present(help )) helpd = help descriptiond = '' ; if (present(description)) descriptiond = description excluded = '' ; if (present(exclude )) excluded = exclude Ng = size(self%clasg,dim=1) allocate(clasg_list_new(0:Ng)) ! clasg_list_new(0:Ng-1) = self%clasg(0:Ng-1) ! Not working on Intel Fortran 15.0.2 do gi = 0, Ng-1 clasg_list_new(gi) = self%clasg(gi) enddo call clasg_list_new(Ng)%assign_object(self) clasg_list_new(Ng)%help = helpd clasg_list_new(Ng)%description = descriptiond clasg_list_new(Ng)%group = group clasg_list_new(Ng)%m_exclude = excluded call clasg_list_new(Ng)%set_examples(examples) deallocate(self%clasg) allocate(self%clasg(0:Ng)) self%clasg = clasg_list_new deallocate(clasg_list_new) endif endsubroutine add_group