flap_command_line_arguments_group_t Module

Command Line Arguments Group (CLAsG) class.


Uses

  • module~~flap_command_line_arguments_group_t~~UsesGraph module~flap_command_line_arguments_group_t flap_command_line_arguments_group_t module~face face module~flap_command_line_arguments_group_t->module~face module~flap_command_line_argument_t flap_command_line_argument_t module~flap_command_line_arguments_group_t->module~flap_command_line_argument_t module~flap_object_t flap_object_t module~flap_command_line_arguments_group_t->module~flap_object_t penf penf module~flap_command_line_arguments_group_t->penf iso_fortran_env iso_fortran_env module~face->iso_fortran_env module~flap_command_line_argument_t->module~face module~flap_command_line_argument_t->module~flap_object_t module~flap_command_line_argument_t->penf module~flap_utils_m flap_utils_m module~flap_command_line_argument_t->module~flap_utils_m module~flap_object_t->penf module~flap_object_t->iso_fortran_env module~flap_utils_m->penf

Used by

  • module~~flap_command_line_arguments_group_t~~UsedByGraph module~flap_command_line_arguments_group_t flap_command_line_arguments_group_t module~flap flap module~flap->module~flap_command_line_arguments_group_t module~flap_command_line_interface_t flap_command_line_interface_t module~flap->module~flap_command_line_interface_t module~flap_command_line_interface_t->module~flap_command_line_arguments_group_t program~flap_save_bash_completion flap_save_bash_completion program~flap_save_bash_completion->module~flap program~flap_save_man_page flap_save_man_page program~flap_save_man_page->module~flap program~flap_save_usage_to_markdown flap_save_usage_to_markdown program~flap_save_usage_to_markdown->module~flap program~flap_test_action_store flap_test_action_store program~flap_test_action_store->module~flap program~flap_test_ansi_color_style flap_test_ansi_color_style program~flap_test_ansi_color_style->module~flap program~flap_test_basic flap_test_basic program~flap_test_basic->module~flap program~flap_test_choices_logical flap_test_choices_logical program~flap_test_choices_logical->module~flap program~flap_test_duplicated_clas flap_test_duplicated_clas program~flap_test_duplicated_clas->module~flap program~flap_test_group flap_test_group program~flap_test_group->module~flap program~flap_test_group_examples flap_test_group_examples program~flap_test_group_examples->module~flap program~flap_test_hidden flap_test_hidden program~flap_test_hidden->module~flap program~flap_test_ignore_unknown_clas flap_test_ignore_unknown_clas program~flap_test_ignore_unknown_clas->module~flap program~flap_test_minimal flap_test_minimal program~flap_test_minimal->module~flap program~flap_test_nargs_insufficient flap_test_nargs_insufficient program~flap_test_nargs_insufficient->module~flap program~flap_test_nargs_insufficient~2 flap_test_nargs_insufficient program~flap_test_nargs_insufficient~2->module~flap program~flap_test_nested flap_test_nested program~flap_test_nested->module~flap program~flap_test_string flap_test_string program~flap_test_string->module~flap

Variables

Type Visibility Attributes Name Initial
integer(kind=I4P), public, parameter :: STATUS_PRINT_V = -1

Print version status.

integer(kind=I4P), public, parameter :: STATUS_PRINT_H = -2

Print help status.

integer(kind=I4P), public, parameter :: STATUS_PRINT_M = -3

Print help status to Markdown file.

integer(kind=I4P), private, parameter :: ERROR_CONSISTENCY = 100

CLAs group consistency error.

integer(kind=I4P), private, parameter :: ERROR_M_EXCLUDE = 101

Two mutually exclusive CLAs group have been called.


Derived Types

type, public, extends(object) ::  command_line_arguments_group

Command Line Arguments Group (CLAsG) class.

Read more…

Components

Type Visibility Attributes Name Initial
character(len=:), public, allocatable :: progname

Program name.

character(len=:), public, allocatable :: version

Program version.

character(len=:), public, allocatable :: help

Help message.

character(len=:), public, allocatable :: help_color

ANSI color of help messages.

character(len=:), public, allocatable :: help_style

ANSI style of help messages.

character(len=:), public, allocatable :: help_markdown

Longer help message, markdown formatted.

character(len=:), public, allocatable :: description

Detailed description.

character(len=:), public, allocatable :: license

License description.

character(len=:), public, allocatable :: authors

Authors list.

character(len=:), public, allocatable :: epilog

Epilogue message.

character(len=:), public, allocatable :: m_exclude

Mutually exclude other CLA(s group).

character(len=:), public, allocatable :: error_message

Meaningful error message to standard-error.

character(len=:), public, allocatable :: error_color

ANSI color of error messages.

character(len=:), public, allocatable :: error_style

ANSI style of error messages.

character(len=512), public, allocatable :: examples(:)

Examples of correct usage.

integer(kind=I4P), public :: error = 0_I4P

Error trapping flag.

integer(kind=I4P), public :: usage_lun = stderr

Output unit to print help/usage messages

integer(kind=I4P), public :: version_lun = stdout

Output unit to print version message

integer(kind=I4P), public :: error_lun = stderr

Error unit to print error messages

character(len=:), public, allocatable :: group

Group name (command).

integer(kind=I4P), public :: Na = 0_I4P

Number of CLA.

integer(kind=I4P), private :: Na_required = 0_I4P

Number of required command line arguments.

integer(kind=I4P), private :: Na_optional = 0_I4P

Number of optional command line arguments.

type(command_line_argument), public, allocatable :: cla(:)

CLA list [1:Na].

logical, public :: is_called = .false.

Flag for checking if CLAs group has been passed to CLI.

Finalizations Procedures

final :: finalize

Free dynamic memory when finalizing.

Type-Bound Procedures

procedure, public, pass(self) :: free_object ../../../../

Free dynamic memory.

procedure, public, pass(self) :: print_version ../../../../

Print version.

procedure, public, pass(self) :: print_error_message ../../../../

Print meaningful error message.

procedure, public, pass(self) :: set_examples ../../../../

Set examples of correct usage.

procedure, public, pass(lhs ) :: assign_object ../../../../

Assignment overloading.

procedure, public :: free ../../../../

Free dynamic memory.

procedure, public :: check ../../../../

Check data consistency.

procedure, public :: is_required_passed ../../../../

Check if required CLAs are passed.

procedure, public :: is_passed ../../../../

Check if a CLA has been passed.

procedure, public :: is_defined ../../../../

Check if a CLA has been defined.

procedure, public :: raise_error_m_exclude ../../../../

Raise error mutually exclusive CLAs passed.

procedure, public :: add ../../../../

Add CLA to CLAsG.

procedure, public :: parse ../../../../

Parse CLAsG arguments.

procedure, public :: usage ../../../../

Get correct CLAsG usage.

procedure, public :: signature ../../../../

Get CLAsG signature.

procedure, public :: sanitize_defaults ../../../../

Sanitize default values.

procedure, private :: errored ../../../../

Trig error occurrence and print meaningful message.

procedure, private :: check_m_exclusive ../../../../

Check if two mutually exclusive CLAs have been passed.

procedure, private :: clasg_assign_clasg ../../../../

Assignment operator.

generic, private :: assignment(=) => clasg_assign_clasg ../../../../

Assignment operator overloading.


Functions

private pure function is_passed(self, switch, position)

Check if a CLA has been passed.

Arguments

Type IntentOptional Attributes Name
class(command_line_arguments_group), intent(in) :: self

CLAsG data.

character(len=*), intent(in), optional :: switch

Switch name.

integer(kind=I4P), intent(in), optional :: position

Position of positional CLA.

Return Value logical

Check if a CLA has been passed.

private function is_defined(self, switch, pos)

Check if a CLA has been defined.

Arguments

Type IntentOptional Attributes Name
class(command_line_arguments_group), intent(in) :: self

CLAsG data.

character(len=*), intent(in) :: switch

Switch name.

integer(kind=I4P), intent(out), optional :: pos

CLA position.

Return Value logical

Check if a CLA has been defined.

private function usage(self, pref, no_header, markdown)

Get correct CLAsG usage.

Arguments

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

Return Value character(len=:), allocatable

Usage string.

private function signature(self, bash_completion, plain)

Get CLAsG signature.

Arguments

Type IntentOptional Attributes Name
class(command_line_arguments_group), intent(in) :: self

CLAsG data.

logical, intent(in), optional :: bash_completion

Return the signature for bash completion.

logical, intent(in), optional :: plain

Return the signature as plain switches list.

Return Value character(len=:), allocatable

Signature.


Subroutines

private elemental subroutine free(self)

Free dynamic memory.

Arguments

Type IntentOptional Attributes Name
class(command_line_arguments_group), intent(inout) :: self

CLAsG data.

private subroutine check(self, pref)

Check data consistency.

Arguments

Type IntentOptional Attributes Name
class(command_line_arguments_group), intent(inout) :: self

CLAsG data.

character(len=*), intent(in), optional :: pref

Prefixing string.

private subroutine is_required_passed(self, pref)

Check if required CLAs are passed.

Arguments

Type IntentOptional Attributes Name
class(command_line_arguments_group), intent(inout) :: self

CLAsG data.

character(len=*), intent(in), optional :: pref

Prefixing string.

private subroutine raise_error_m_exclude(self, pref)

Raise error mutually exclusive CLAs passed.

Arguments

Type IntentOptional Attributes Name
class(command_line_arguments_group), intent(inout) :: self

CLA data.

character(len=*), intent(in), optional :: pref

Prefixing string.

private subroutine add(self, pref, cla)

Add CLA to CLAs list.

Read more…

Arguments

Type IntentOptional Attributes Name
class(command_line_arguments_group), intent(inout) :: self

CLAsG data.

character(len=*), intent(in), optional :: pref

Prefixing string.

type(command_line_argument), intent(in) :: cla

CLA data.

private subroutine parse(self, args, ignore_unknown_clas, pref, error_unknown_clas)

Parse CLAsG arguments.

Arguments

Type IntentOptional Attributes Name
class(command_line_arguments_group), intent(inout) :: self

CLAsG data.

character(len=*), intent(in) :: args(:)

Command line arguments.

logical, intent(in) :: ignore_unknown_clas

Disable errors-raising for passed unknown CLAs.

character(len=*), intent(in), optional :: pref

Prefixing string.

integer(kind=I4P), intent(out) :: error_unknown_clas

Error flag for passed unknown CLAs.

private subroutine errored(self, error, pref, a1, a2)

Trig error occurrence and print meaningful message.

Arguments

Type IntentOptional Attributes Name
class(command_line_arguments_group), intent(inout) :: self

CLAsG data.

integer(kind=I4P), intent(in) :: error

Error occurred.

character(len=*), intent(in), optional :: pref

Prefixing string.

integer(kind=I4P), intent(in), optional :: a1

First index CLAs group inconsistent.

integer(kind=I4P), intent(in), optional :: a2

Second index CLAs group inconsistent.

private subroutine check_m_exclusive(self, pref)

Check if two mutually exclusive CLAs have been passed.

Arguments

Type IntentOptional Attributes Name
class(command_line_arguments_group), intent(inout) :: self

CLAsG data.

character(len=*), intent(in), optional :: pref

Prefixing string.

private subroutine sanitize_defaults(self)

Sanitize defaults values.

Read more…

Arguments

Type IntentOptional Attributes Name
class(command_line_arguments_group), intent(inout) :: self

CLAsG data.

private elemental subroutine clasg_assign_clasg(lhs, rhs)

Assignment operator.

Arguments

Type IntentOptional Attributes Name
class(command_line_arguments_group), intent(inout) :: lhs

Left hand side.

type(command_line_arguments_group), intent(in) :: rhs

Right hand side.

private elemental subroutine finalize(self)

Free dynamic memory when finalizing.

Arguments

Type IntentOptional Attributes Name
type(command_line_arguments_group), intent(inout) :: self

CLAsG data.