flap_command_line_interface_t Module

Command Line Interface (CLI) class.


Uses

  • module~~flap_command_line_interface_t~~UsesGraph module~flap_command_line_interface_t flap_command_line_interface_t module~face face module~flap_command_line_interface_t->module~face module~flap_command_line_argument_t flap_command_line_argument_t module~flap_command_line_interface_t->module~flap_command_line_argument_t module~flap_command_line_arguments_group_t flap_command_line_arguments_group_t module~flap_command_line_interface_t->module~flap_command_line_arguments_group_t module~flap_object_t flap_object_t module~flap_command_line_interface_t->module~flap_object_t module~flap_utils_m flap_utils_m module~flap_command_line_interface_t->module~flap_utils_m penf penf module~flap_command_line_interface_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->module~flap_utils_m module~flap_command_line_argument_t->penf module~flap_command_line_arguments_group_t->module~face module~flap_command_line_arguments_group_t->module~flap_command_line_argument_t module~flap_command_line_arguments_group_t->module~flap_object_t module~flap_command_line_arguments_group_t->penf module~flap_object_t->penf module~flap_object_t->iso_fortran_env module~flap_utils_m->penf

Used by

  • module~~flap_command_line_interface_t~~UsedByGraph module~flap_command_line_interface_t flap_command_line_interface_t module~flap flap module~flap->module~flap_command_line_interface_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 :: MAX_VAL_LEN = 1000

Maximum number of characters of CLA value.

integer(kind=I4P), public, parameter :: ERROR_MISSING_CLA = 1000

CLA not found in CLI.

integer(kind=I4P), public, parameter :: ERROR_MISSING_GROUP = 1001

Group not found in CLI.

integer(kind=I4P), public, parameter :: ERROR_MISSING_SELECTION_CLA = 1002

CLA selection in CLI failing.

integer(kind=I4P), public, parameter :: ERROR_TOO_FEW_CLAS = 1003

Insufficient arguments for CLI.

integer(kind=I4P), public, parameter :: ERROR_UNKNOWN_CLAS_IGNORED = 1004

Unknown CLAs passed, but ignored.


Derived Types

type, public, extends(object) ::  command_line_interface

Command Line Interface (CLI) class.

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

type(command_line_arguments_group), private, allocatable :: clasg(:)

CLA list [1:Na].

character(len=512), private, allocatable :: args(:)

Actually passed command line arguments.

logical, private :: disable_hv = .false.

Disable automatic ‘help’ and ‘version’ CLAs.

logical, private :: is_parsed_ = .false.

Parse status.

logical, private :: ignore_unknown_clas = .false.

Disable errors-raising for passed unknown CLAs.

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

Error trapping flag for unknown CLAs.

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 :: init ../../../../

Initialize CLI.

procedure, public :: add_group ../../../../

Add CLAs group CLI.

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

Add CLA to CLI.

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

Check if a CLA has been passed.

procedure, public :: is_defined_group ../../../../

Check if a CLAs group has been defined.

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

Check if a CLA has been defined.

procedure, public :: is_parsed ../../../../

Check if CLI has been parsed.

procedure, public :: set_mutually_exclusive_groups ../../../../

Set two CLAs group as mutually exclusive.

procedure, public :: run_command => is_called_group ../../../../

Check if a CLAs group has been run.

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

Parse Command Line Interfaces.

generic, public :: get => get_cla, get_cla_list ../../../../

Get CLA value(s) from CLAs list parsed.

generic, public :: get_varying => get_cla_list_varying_R8P, get_cla_list_varying_R4P, get_cla_list_varying_I8P, get_cla_list_varying_I4P, get_cla_list_varying_I2P, get_cla_list_varying_I1P, get_cla_list_varying_logical, get_cla_list_varying_char ../../../../

Get CLA value(s) from CLAs list parsed, varying size list.

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

Get CLI usage.

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

Get CLI signature.

procedure, public :: print_usage ../../../../

Print correct usage of CLI.

procedure, public :: save_bash_completion ../../../../

Save bash completion script (for named CLAs only).

procedure, public :: save_man_page ../../../../

Save CLI usage as man page.

procedure, public :: save_usage_to_markdown ../../../../

Save CLI usage as markdown.

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

Trig error occurence and print meaningful message.

procedure, private :: check ../../../../

Check data consistency.

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

Check if two mutually exclusive CLAs group have been called.

procedure, private :: get_clasg_indexes ../../../../

Get CLAs groups indexes.

generic, private :: get_args => get_args_from_string, get_args_from_invocation ../../../../

Get CLAs.

procedure, private :: get_args_from_string ../../../../

Get CLAs from string.

procedure, private :: get_args_from_invocation ../../../../

Get CLAs from CLI invocation.

procedure, private :: get_cla ../../../../

Get CLA (single) value from CLAs list parsed.

procedure, private :: get_cla_list ../../../../

Get CLA multiple values from CLAs list parsed.

procedure, private :: get_cla_list_varying_R16P ../../../../

Get CLA multiple values from CLAs list parsed, varying size, R16P.

procedure, private :: get_cla_list_varying_R8P ../../../../

Get CLA multiple values from CLAs list parsed, varying size, R8P.

procedure, private :: get_cla_list_varying_R4P ../../../../

Get CLA multiple values from CLAs list parsed, varying size, R4P.

procedure, private :: get_cla_list_varying_I8P ../../../../

Get CLA multiple values from CLAs list parsed, varying size, I8P.

procedure, private :: get_cla_list_varying_I4P ../../../../

Get CLA multiple values from CLAs list parsed, varying size, I4P.

procedure, private :: get_cla_list_varying_I2P ../../../../

Get CLA multiple values from CLAs list parsed, varying size, I2P.

procedure, private :: get_cla_list_varying_I1P ../../../../

Get CLA multiple values from CLAs list parsed, varying size, I1P.

procedure, private :: get_cla_list_varying_logical ../../../../

Get CLA multiple values from CLAs list parsed, varying size, bool.

procedure, private :: get_cla_list_varying_char ../../../../

Get CLA multiple values from CLAs list parsed, varying size, char.

procedure, private :: cli_assign_cli ../../../../

CLI assignment overloading.

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

CLI assignment overloading.


Functions

private function is_passed(self, group, switch, position)

Check if a CLA has been passed.

Arguments

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

CLI data.

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

Name of group (command) of CLA.

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_group(self, group, g) result(defined)

Check if a CLAs group has been defined.

Arguments

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

CLI data.

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

Name of group (command) of CLAs.

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

Index of group.

Return Value logical

Check if a CLAs group has been defined.

private function is_called_group(self, group) result(called)

Check if a CLAs group has been run.

Arguments

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

CLI data.

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

Name of group (command) of CLAs.

Return Value logical

Check if a CLAs group has been runned.

private function is_defined(self, switch, group)

Check if a CLA has been defined.

Arguments

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

CLI data.

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

Switch name.

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

Name of group (command) of CLAs.

Return Value logical

Check if a CLA has been defined.

private elemental function is_parsed(self)

Check if CLI has been parsed.

Arguments

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

CLI data.

Return Value logical

Parsed status.

private function usage(self, g, pref, no_header, no_examples, no_epilog, markdown) result(usaged)

Print correct usage of CLI.

Arguments

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

CLI data.

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

Group index.

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

Prefixing string.

logical, intent(in), optional :: no_header

Avoid insert header to usage.

logical, intent(in), optional :: no_examples

Avoid insert examples to usage.

logical, intent(in), optional :: no_epilog

Avoid insert epilogue to usage.

logical, intent(in), optional :: markdown

Format things with markdown

Return Value character(len=:), allocatable

Usage string.

private function signature(self, bash_completion)

Get signature.

Arguments

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

CLI data.

logical, intent(in), optional :: bash_completion

Return the signature for bash completion.

Return Value character(len=:), allocatable

Signature.


Subroutines

private elemental subroutine free(self)

Free dynamic memory.

Arguments

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

CLI data.

private subroutine init(self, progname, version, help, description, license, authors, examples, epilog, disable_hv, usage_lun, error_lun, version_lun, error_color, error_style, ignore_unknown_clas)

Initialize CLI.

Arguments

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

CLI data.

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

Program name.

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

Program version.

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

Help message introducing the CLI usage.

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

Detailed description message introducing the program.

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

License description.

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

Authors list.

character(len=*), intent(in), optional :: examples(1:)

Examples of correct usage.

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

Epilog message.

logical, intent(in), optional :: disable_hv

Disable automatic insert of ‘help’ and ‘version’ CLAs.

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

Unit number to print usage/help.

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

Unit number to print error info.

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

Unit number to print version/license info.

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

ANSI color of error messages.

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

ANSI style of error messages.

logical, intent(in), optional :: ignore_unknown_clas

Disable errors-raising for passed unknown CLAs.

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

Add CLAs group to CLI.

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.

private subroutine set_mutually_exclusive_groups(self, group1, group2)

Set two CLAs group ad mutually exclusive.

Arguments

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

CLI data.

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

Name of the first grouped CLAs.

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

Name of the second grouped CLAs.

private subroutine add(self, pref, group, group_index, switch, switch_ab, help, help_markdown, help_color, help_style, required, val_required, positional, position, hidden, act, def, nargs, choices, exclude, envvar, error)

Add CLA to CLI.

Read more…

Arguments

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

CLI data.

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

Prefixing string.

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

Name of the grouped CLAs.

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

Index of the grouped CLAs.

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

Switch name.

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

Abbreviated switch name.

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

Help message describing the CLA.

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

Longer help message, markdown formatted.

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

ANSI color of help messages.

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

ANSI style of help messages.

logical, intent(in), optional :: required

Flag for set required argument.

logical, intent(in), optional :: val_required

Flag for set value required for optional argument.

logical, intent(in), optional :: positional

Flag for checking if CLA is a positional or a named CLA.

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

Position of positional CLA.

logical, intent(in), optional :: hidden

Flag for hiding CLA, thus it does not compare into help.

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

CLA value action.

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

Default value.

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

Number of arguments consumed by CLA.

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

List of allowable values for the argument.

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

Switch name of the mutually exclusive CLA.

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

Environment variable from which take value.

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

Error trapping flag.

private subroutine check(self, pref, error)

Check data consistency.

Arguments

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

CLI data.

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

Prefixing string.

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

Error trapping flag.

private subroutine check_m_exclusive(self, pref)

Check if two mutually exclusive CLAs group have been called.

Arguments

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

CLI data.

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

Prefixing string.

private subroutine parse(self, pref, args, error)

Parse Command Line Interfaces by means of a previously initialized CLAs groups list.

Read more…

Arguments

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

CLI data.

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

Prefixing string.

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

String containing command line arguments.

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

Error trapping flag.

private subroutine get_clasg_indexes(self, ai)

Get the argument indexes of CLAs groups defined parsing the actual passed CLAs.

Arguments

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

CLI data.

integer(kind=I4P), intent(out), allocatable :: ai(:,:)

CLAs grouped indexes.

private subroutine get_args_from_string(self, args, ai)

Get CLAs from string.

Arguments

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

CLI data.

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

String containing command line arguments.

integer(kind=I4P), intent(out), allocatable :: ai(:,:)

CLAs grouped indexes.

private subroutine get_args_from_invocation(self, ai)

Get CLAs from CLI invocation.

Arguments

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

CLI data.

integer(kind=I4P), intent(out), allocatable :: ai(:,:)

CLAs grouped indexes.

private subroutine get_cla(self, val, pref, args, group, switch, position, error)

Get CLA (single) value from CLAs list parsed.

Read more…

Arguments

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

CLI data.

class(*), intent(inout) :: val

CLA value.

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

Prefixing string.

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

String containing command line arguments.

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

Name of group (command) of CLA.

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

Switch name.

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

Position of positional CLA.

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

Error trapping flag.

private subroutine get_cla_list(self, val, pref, args, group, switch, position, error)

Get CLA multiple values from CLAs list parsed.

Read more…

Arguments

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

CLI data.

class(*), intent(inout) :: val(1:)

CLA values.

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

Prefixing string.

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

String containing command line arguments.

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

Name of group (command) of CLA.

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

Switch name.

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

Position of positional CLA.

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

Error trapping flag.

private subroutine get_cla_list_varying_R16P(self, val, pref, args, group, switch, position, error)

Get CLA multiple values from CLAs list parsed with varying size list, real(R16P).

Read more…

Arguments

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

CLI data.

real(kind=R16P), intent(out), allocatable :: val(:)

CLA values.

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

Prefixing string.

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

String containing command line arguments.

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

Name of group (command) of CLA.

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

Switch name.

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

Position of positional CLA.

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

Error trapping flag.

private subroutine get_cla_list_varying_R8P(self, val, pref, args, group, switch, position, error)

Get CLA multiple values from CLAs list parsed with varying size list, real(R8P).

Read more…

Arguments

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

CLI data.

real(kind=R8P), intent(out), allocatable :: val(:)

CLA values.

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

Prefixing string.

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

String containing command line arguments.

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

Name of group (command) of CLA.

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

Switch name.

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

Position of positional CLA.

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

Error trapping flag.

private subroutine get_cla_list_varying_R4P(self, val, pref, args, group, switch, position, error)

Get CLA multiple values from CLAs list parsed with varying size list, real(R4P).

Read more…

Arguments

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

CLI data.

real(kind=R4P), intent(out), allocatable :: val(:)

CLA values.

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

Prefixing string.

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

String containing command line arguments.

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

Name of group (command) of CLA.

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

Switch name.

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

Position of positional CLA.

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

Error trapping flag.

private subroutine get_cla_list_varying_I8P(self, val, pref, args, group, switch, position, error)

Get CLA multiple values from CLAs list parsed with varying size list, integer(I8P).

Read more…

Arguments

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

CLI data.

integer(kind=I8P), intent(out), allocatable :: val(:)

CLA values.

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

Prefixing string.

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

String containing command line arguments.

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

Name of group (command) of CLA.

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

Switch name.

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

Position of positional CLA.

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

Error trapping flag.

private subroutine get_cla_list_varying_I4P(self, val, pref, args, group, switch, position, error)

Get CLA multiple values from CLAs list parsed with varying size list, integer(I4P).

Read more…

Arguments

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

CLI data.

integer(kind=I4P), intent(out), allocatable :: val(:)

CLA values.

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

Prefixing string.

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

String containing command line arguments.

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

Name of group (command) of CLA.

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

Switch name.

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

Position of positional CLA.

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

Error trapping flag.

private subroutine get_cla_list_varying_I2P(self, val, pref, args, group, switch, position, error)

Get CLA multiple values from CLAs list parsed with varying size list, integer(I2P).

Read more…

Arguments

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

CLI data.

integer(kind=I2P), intent(out), allocatable :: val(:)

CLA values.

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

Prefixing string.

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

String containing command line arguments.

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

Name of group (command) of CLA.

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

Switch name.

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

Position of positional CLA.

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

Error trapping flag.

private subroutine get_cla_list_varying_I1P(self, val, pref, args, group, switch, position, error)

Get CLA multiple values from CLAs list parsed with varying size list, integer(I1P).

Read more…

Arguments

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

CLI data.

integer(kind=I1P), intent(out), allocatable :: val(:)

CLA values.

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

Prefixing string.

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

String containing command line arguments.

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

Name of group (command) of CLA.

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

Switch name.

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

Position of positional CLA.

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

Error trapping flag.

private subroutine get_cla_list_varying_logical(self, val, pref, args, group, switch, position, error)

Get CLA multiple values from CLAs list parsed with varying size list, logical.

Read more…

Arguments

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

CLI data.

logical, intent(out), allocatable :: val(:)

CLA values.

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

Prefixing string.

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

String containing command line arguments.

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

Name of group (command) of CLA.

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

Switch name.

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

Position of positional CLA.

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

Error trapping flag.

private subroutine get_cla_list_varying_char(self, val, pref, args, group, switch, position, error)

Get CLA multiple values from CLAs list parsed with varying size list, character.

Read more…

Arguments

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

CLI data.

character(len=*), intent(out), allocatable :: val(:)

CLA values.

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

Prefixing string.

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

String containing command line arguments.

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

Name of group (command) of CLA.

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

Switch name.

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

Position of positional CLA.

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

Error trapping flag.

private subroutine print_usage(self, pref)

Print correct usage.

Arguments

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

CLI data.

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

Prefixing string.

private subroutine save_bash_completion(self, bash_file, error)

Save bash completion script (for named CLAs only).

Arguments

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

CLI data.

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

Output file name of bash completion script.

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

Error trapping flag.

private subroutine save_man_page(self, man_file, error)

Save CLI usage as man page.

Arguments

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

CLI data.

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

Output file name for saving man page.

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

Error trapping flag.

private subroutine save_usage_to_markdown(self, markdown_file, error)

Save CLI usage as markdown.

Arguments

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

CLI data.

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

Output file name for saving man page.

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

Error trapping flag.

private subroutine errored(self, error, pref, group, switch)

Trig error occurrence and print meaningful message.

Arguments

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

Object data.

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

Error occurred.

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

Prefixing string.

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

Group name.

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

CLA switch name.

private elemental subroutine cli_assign_cli(lhs, rhs)

Assignment operator.

Arguments

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

Left hand side.

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

Right hand side.

private elemental subroutine finalize(self)

Free dynamic memory when finalizing.

Arguments

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

CLI data.