Command Line Arguments Group (CLAsG) class.
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. |
Command Line Arguments Group (CLAsG) class.
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. |
final :: finalize | Free dynamic memory when finalizing. |
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. |
Check if a CLA has been passed.
Type | Intent | Optional | 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. |
Check if a CLA has been passed.
Check if a CLA has been defined.
Type | Intent | Optional | 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. |
Check if a CLA has been defined.
Get correct CLAsG usage.
Type | Intent | Optional | 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. |
Usage string.
Get CLAsG signature.
Type | Intent | Optional | 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. |
Signature.
Free dynamic memory.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(command_line_arguments_group), | intent(inout) | :: | self |
CLAsG data. |
Check data consistency.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(command_line_arguments_group), | intent(inout) | :: | self |
CLAsG data. |
||
character(len=*), | intent(in), | optional | :: | pref |
Prefixing string. |
Check if required CLAs are passed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(command_line_arguments_group), | intent(inout) | :: | self |
CLAsG data. |
||
character(len=*), | intent(in), | optional | :: | pref |
Prefixing string. |
Raise error mutually exclusive CLAs passed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(command_line_arguments_group), | intent(inout) | :: | self |
CLA data. |
||
character(len=*), | intent(in), | optional | :: | pref |
Prefixing string. |
Add CLA to CLAs list.
Type | Intent | Optional | 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. |
Parse CLAsG arguments.
Type | Intent | Optional | 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. |
Trig error occurrence and print meaningful message.
Type | Intent | Optional | 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. |
Check if two mutually exclusive CLAs have been passed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(command_line_arguments_group), | intent(inout) | :: | self |
CLAsG data. |
||
character(len=*), | intent(in), | optional | :: | pref |
Prefixing string. |
Sanitize defaults values.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(command_line_arguments_group), | intent(inout) | :: | self |
CLAsG data. |
Assignment operator.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(command_line_arguments_group), | intent(inout) | :: | lhs |
Left hand side. |
||
type(command_line_arguments_group), | intent(in) | :: | rhs |
Right hand side. |
Free dynamic memory when finalizing.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(command_line_arguments_group), | intent(inout) | :: | self |
CLAsG data. |