Skip to content

flap_command_line_arguments_group_t

Command Line Arguments Group (CLAsG) class.

Source: src/lib/flap_command_line_arguments_group_t.f90

Dependencies

Contents

Variables

NameTypeAttributesDescription
STATUS_PRINT_Vinteger(kind=I4P)parameterPrint version status.
STATUS_PRINT_Hinteger(kind=I4P)parameterPrint help status.
STATUS_PRINT_Minteger(kind=I4P)parameterPrint help status to Markdown file.
ERROR_CONSISTENCYinteger(kind=I4P)parameterCLAs group consistency error.
ERROR_M_EXCLUDEinteger(kind=I4P)parameterTwo mutually exclusive CLAs group have been called.

Derived Types

command_line_arguments_group

Command Line Arguments Group (CLAsG) class.

CLAsG are useful for building nested commands.

Inheritance

Extends: object

Components

NameTypeAttributesDescription
prognamecharacter(len=:)allocatableProgram name.
versioncharacter(len=:)allocatableProgram version.
helpcharacter(len=:)allocatableHelp message.
help_colorcharacter(len=:)allocatableANSI color of help messages.
help_stylecharacter(len=:)allocatableANSI style of help messages.
help_markdowncharacter(len=:)allocatableLonger help message, markdown formatted.
descriptioncharacter(len=:)allocatableDetailed description.
licensecharacter(len=:)allocatableLicense description.
authorscharacter(len=:)allocatableAuthors list.
epilogcharacter(len=:)allocatableEpilogue message.
m_excludecharacter(len=:)allocatableMutually exclude other CLA(s group).
error_messagecharacter(len=:)allocatableMeaningful error message to standard-error.
error_colorcharacter(len=:)allocatableANSI color of error messages.
error_stylecharacter(len=:)allocatableANSI style of error messages.
examplescharacter(len=512)allocatableExamples of correct usage.
errorinteger(kind=I4P)Error trapping flag.
usage_luninteger(kind=I4P)Output unit to print help/usage messages
version_luninteger(kind=I4P)Output unit to print version message
error_luninteger(kind=I4P)Error unit to print error messages
groupcharacter(len=:)allocatableGroup name (command).
Nainteger(kind=I4P)Number of CLA.
Na_requiredinteger(kind=I4P)Number of required command line arguments.
Na_optionalinteger(kind=I4P)Number of optional command line arguments.
clatype(command_line_argument)allocatableCLA list [1:Na].
is_calledlogicalFlag for checking if CLAs group has been passed to CLI.

Type-Bound Procedures

NameAttributesDescription
free_objectpass(self)Free dynamic memory.
print_versionpass(self)Print version.
print_error_messagepass(self)Print meaningful error message.
set_examplespass(self)Set examples of correct usage.
assign_objectpass(lhs )Assignment overloading.
freeFree dynamic memory.
checkCheck data consistency.
is_required_passedCheck if required CLAs are passed.
is_passedCheck if a CLA has been passed.
is_definedCheck if a CLA has been defined.
raise_error_m_excludeRaise error mutually exclusive CLAs passed.
addAdd CLA to CLAsG.
parseParse CLAsG arguments.
usageGet correct CLAsG usage.
signatureGet CLAsG signature.
sanitize_defaultsSanitize default values.
erroredTrig error occurrence and print meaningful message.
check_m_exclusiveCheck if two mutually exclusive CLAs have been passed.
clasg_assign_clasgAssignment operator.
assignment(=)Assignment operator overloading.

Subroutines

free

Free dynamic memory.

Attributes: elemental

fortran
subroutine free(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(command_line_arguments_group)inoutCLAsG data.

Call graph

check

Check data consistency.

fortran
subroutine check(self, pref)

Arguments

NameTypeIntentAttributesDescription
selfclass(command_line_arguments_group)inoutCLAsG data.
prefcharacter(len=*)inoptionalPrefixing string.

Call graph

is_required_passed

Check if required CLAs are passed.

fortran
subroutine is_required_passed(self, pref)

Arguments

NameTypeIntentAttributesDescription
selfclass(command_line_arguments_group)inoutCLAsG data.
prefcharacter(len=*)inoptionalPrefixing string.

Call graph

raise_error_m_exclude

Raise error mutually exclusive CLAs passed.

fortran
subroutine raise_error_m_exclude(self, pref)

Arguments

NameTypeIntentAttributesDescription
selfclass(command_line_arguments_group)inoutCLA data.
prefcharacter(len=*)inoptionalPrefixing string.

Call graph

add

Add CLA to CLAs list.

@note If not otherwise declared the action on CLA value is set to "store" a value that must be passed after the switch name or directly passed in case of positional CLA.

fortran
subroutine add(self, pref, cla)

Arguments

NameTypeIntentAttributesDescription
selfclass(command_line_arguments_group)inoutCLAsG data.
prefcharacter(len=*)inoptionalPrefixing string.
clatype(command_line_argument)inCLA data.

Call graph

parse

Parse CLAsG arguments.

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

Arguments

NameTypeIntentAttributesDescription
selfclass(command_line_arguments_group)inoutCLAsG data.
argscharacter(len=*)inCommand line arguments.
ignore_unknown_claslogicalinDisable errors-raising for passed unknown CLAs.
prefcharacter(len=*)inoptionalPrefixing string.
error_unknown_clasinteger(kind=I4P)outError flag for passed unknown CLAs.

Call graph

errored

Trig error occurrence and print meaningful message.

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

Arguments

NameTypeIntentAttributesDescription
selfclass(command_line_arguments_group)inoutCLAsG data.
errorinteger(kind=I4P)inError occurred.
prefcharacter(len=*)inoptionalPrefixing string.
a1integer(kind=I4P)inoptionalFirst index CLAs group inconsistent.
a2integer(kind=I4P)inoptionalSecond index CLAs group inconsistent.

Call graph

check_m_exclusive

Check if two mutually exclusive CLAs have been passed.

fortran
subroutine check_m_exclusive(self, pref)

Arguments

NameTypeIntentAttributesDescription
selfclass(command_line_arguments_group)inoutCLAsG data.
prefcharacter(len=*)inoptionalPrefixing string.

Call graph

sanitize_defaults

Sanitize defaults values.

It is necessary to sanitize the default values of non-passed, optional CLAs.

fortran
subroutine sanitize_defaults(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(command_line_arguments_group)inoutCLAsG data.

Call graph

clasg_assign_clasg

Assignment operator.

Attributes: elemental

fortran
subroutine clasg_assign_clasg(lhs, rhs)

Arguments

NameTypeIntentAttributesDescription
lhsclass(command_line_arguments_group)inoutLeft hand side.
rhstype(command_line_arguments_group)inRight hand side.

Call graph

finalize

Free dynamic memory when finalizing.

Attributes: elemental

fortran
subroutine finalize(self)

Arguments

NameTypeIntentAttributesDescription
selftype(command_line_arguments_group)inoutCLAsG data.

Functions

is_passed

Check if a CLA has been passed.

Attributes: pure

Returns: logical

fortran
function is_passed(self, switch, position)

Arguments

NameTypeIntentAttributesDescription
selfclass(command_line_arguments_group)inCLAsG data.
switchcharacter(len=*)inoptionalSwitch name.
positioninteger(kind=I4P)inoptionalPosition of positional CLA.

Call graph

is_defined

Check if a CLA has been defined.

Returns: logical

fortran
function is_defined(self, switch, pos)

Arguments

NameTypeIntentAttributesDescription
selfclass(command_line_arguments_group)inCLAsG data.
switchcharacter(len=*)inSwitch name.
posinteger(kind=I4P)outoptionalCLA position.

Call graph

usage

Get correct CLAsG usage.

Returns: character(len=:)

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

Arguments

NameTypeIntentAttributesDescription
selfclass(command_line_arguments_group)inCLAsG data.
prefcharacter(len=*)inoptionalPrefixing string.
no_headerlogicalinoptionalAvoid insert header to usage.
markdownlogicalinoptionalFormat things form markdown.

Call graph

signature

Get CLAsG signature.

Returns: character(len=:)

fortran
function signature(self, bash_completion, plain)

Arguments

NameTypeIntentAttributesDescription
selfclass(command_line_arguments_group)inCLAsG data.
bash_completionlogicalinoptionalReturn the signature for bash completion.
plainlogicalinoptionalReturn the signature as plain switches list.

Call graph