add_group Subroutine

private subroutine add_group(self, help, description, exclude, examples, group)

Add CLAs group to CLI.

Type Bound

command_line_interface

Arguments

Type IntentOptional 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.


Calls

proc~~add_group~~CallsGraph proc~add_group flap_command_line_interface_t::command_line_interface%add_group proc~assign_object flap_object_t::object%assign_object proc~add_group->proc~assign_object proc~is_defined_group flap_command_line_interface_t::command_line_interface%is_defined_group proc~add_group->proc~is_defined_group proc~set_examples flap_object_t::object%set_examples proc~add_group->proc~set_examples

Called by

proc~~add_group~~CalledByGraph proc~add_group flap_command_line_interface_t::command_line_interface%add_group proc~add~2 flap_command_line_interface_t::command_line_interface%add proc~add~2->proc~add_group proc~fake_call flap_test_group::fake_call proc~fake_call->proc~add_group proc~fake_call->proc~add~2 proc~parse~2 flap_command_line_interface_t::command_line_interface%parse proc~fake_call->proc~parse~2 none~get~2 flap_command_line_interface_t::command_line_interface%get proc~fake_call->none~get~2 program~flap_save_bash_completion flap_save_bash_completion program~flap_save_bash_completion->proc~add_group program~flap_save_bash_completion->proc~add~2 program~flap_save_bash_completion->proc~parse~2 program~flap_test_group_examples flap_test_group_examples program~flap_test_group_examples->proc~add_group program~flap_test_group_examples->proc~add~2 program~flap_test_group_examples->none~get~2 program~flap_test_nested flap_test_nested program~flap_test_nested->proc~add_group program~flap_test_nested->proc~add~2 program~flap_test_nested->proc~parse~2 program~flap_test_nested->none~get~2 proc~parse~2->proc~add~2 program~flap_save_man_page flap_save_man_page program~flap_save_man_page->proc~add~2 program~flap_save_man_page->none~get~2 program~flap_save_usage_to_markdown flap_save_usage_to_markdown program~flap_save_usage_to_markdown->proc~add~2 program~flap_save_usage_to_markdown->none~get~2 program~flap_test_action_store flap_test_action_store program~flap_test_action_store->proc~add~2 none~get_varying~2 flap_command_line_interface_t::command_line_interface%get_varying program~flap_test_action_store->none~get_varying~2 program~flap_test_action_store->none~get~2 program~flap_test_ansi_color_style flap_test_ansi_color_style program~flap_test_ansi_color_style->proc~add~2 program~flap_test_ansi_color_style->none~get~2 program~flap_test_basic flap_test_basic program~flap_test_basic->proc~add~2 program~flap_test_basic->proc~parse~2 program~flap_test_basic->none~get_varying~2 program~flap_test_basic->none~get~2 program~flap_test_choices_logical flap_test_choices_logical program~flap_test_choices_logical->proc~add~2 program~flap_test_choices_logical->proc~parse~2 program~flap_test_choices_logical->none~get~2 program~flap_test_duplicated_clas flap_test_duplicated_clas program~flap_test_duplicated_clas->proc~add~2 program~flap_test_duplicated_clas->none~get~2 program~flap_test_group flap_test_group program~flap_test_group->proc~fake_call program~flap_test_hidden flap_test_hidden program~flap_test_hidden->proc~add~2 program~flap_test_hidden->none~get~2 program~flap_test_ignore_unknown_clas flap_test_ignore_unknown_clas program~flap_test_ignore_unknown_clas->proc~add~2 program~flap_test_ignore_unknown_clas->none~get~2 program~flap_test_minimal flap_test_minimal program~flap_test_minimal->proc~add~2 program~flap_test_minimal->none~get~2 program~flap_test_nargs_insufficient flap_test_nargs_insufficient program~flap_test_nargs_insufficient->proc~add~2 program~flap_test_nargs_insufficient->none~get~2 program~flap_test_nargs_insufficient~2 flap_test_nargs_insufficient program~flap_test_nargs_insufficient~2->proc~add~2 program~flap_test_nargs_insufficient~2->none~get~2 program~flap_test_string flap_test_string program~flap_test_string->proc~add~2 program~flap_test_string->proc~parse~2 program~flap_test_string->none~get~2 proc~get_cla_list_varying_char~2 flap_command_line_interface_t::command_line_interface%get_cla_list_varying_char proc~get_cla_list_varying_char~2->proc~parse~2 proc~get_cla_list_varying_i1p~2 flap_command_line_interface_t::command_line_interface%get_cla_list_varying_I1P proc~get_cla_list_varying_i1p~2->proc~parse~2 proc~get_cla_list_varying_i2p~2 flap_command_line_interface_t::command_line_interface%get_cla_list_varying_I2P proc~get_cla_list_varying_i2p~2->proc~parse~2 proc~get_cla_list_varying_i4p~2 flap_command_line_interface_t::command_line_interface%get_cla_list_varying_I4P proc~get_cla_list_varying_i4p~2->proc~parse~2 proc~get_cla_list_varying_i8p~2 flap_command_line_interface_t::command_line_interface%get_cla_list_varying_I8P proc~get_cla_list_varying_i8p~2->proc~parse~2 proc~get_cla_list_varying_logical~2 flap_command_line_interface_t::command_line_interface%get_cla_list_varying_logical proc~get_cla_list_varying_logical~2->proc~parse~2 proc~get_cla_list_varying_r16p~2 flap_command_line_interface_t::command_line_interface%get_cla_list_varying_R16P proc~get_cla_list_varying_r16p~2->proc~parse~2 proc~get_cla_list_varying_r4p~2 flap_command_line_interface_t::command_line_interface%get_cla_list_varying_R4P proc~get_cla_list_varying_r4p~2->proc~parse~2 proc~get_cla_list_varying_r8p~2 flap_command_line_interface_t::command_line_interface%get_cla_list_varying_R8P proc~get_cla_list_varying_r8p~2->proc~parse~2 proc~get_cla_list~2 flap_command_line_interface_t::command_line_interface%get_cla_list proc~get_cla_list~2->proc~parse~2 proc~get_cla~2 flap_command_line_interface_t::command_line_interface%get_cla proc~get_cla~2->proc~parse~2 none~get_varying~2->proc~get_cla_list_varying_char~2 none~get_varying~2->proc~get_cla_list_varying_i1p~2 none~get_varying~2->proc~get_cla_list_varying_i2p~2 none~get_varying~2->proc~get_cla_list_varying_i4p~2 none~get_varying~2->proc~get_cla_list_varying_i8p~2 none~get_varying~2->proc~get_cla_list_varying_logical~2 none~get_varying~2->proc~get_cla_list_varying_r4p~2 none~get_varying~2->proc~get_cla_list_varying_r8p~2 none~get~2->proc~get_cla_list~2 none~get~2->proc~get_cla~2

Source Code

  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