Skip to content
Stefano Zaghi edited this page Mar 23, 2016 · 3 revisions

init

Signature

call cli%init(progname, version, help, description, license, authors, examples, epilog, disable_hv)
Meaning

Initialize your CLI. All dummy arguments are optionals.

Dummy arguments
character(*), optional, intent(in) :: progname     !< Program name.
character(*), optional, intent(in) :: version      !< Program version.
character(*), optional, intent(in) :: help         !< Help message introducing the CLI usage.
character(*), optional, intent(in) :: description  !< Detailed description message introducing the program.
character(*), optional, intent(in) :: license      !< License description.
character(*), optional, intent(in) :: authors      !< Authors list.
character(*), optional, intent(in) :: examples(1:) !< Examples of correct usage.
character(*), optional, intent(in) :: epilog       !< Epilog message.
logical,      optional, intent(in) :: disable_hv   !< Disable automatic inserting of 'help' and 'version' CLAs.

The default values of them are:

progname='program'
version='unknown'
help='usage: '
description=''
license=''
authors=''
epilog=''
disable_hv=.false.

the examples array is not allocated by default.

Usage

Must be used for initializing CLI

use flap

type(command_line_interface):: cli

call cli%init(progname="My Program",                       &
              version="1.2.3",                             &
              help="to be used as:",                       &
              description="Just a toy example, do nothing",&
              license="MIT",                               &
              authors"Jhon and Joane Doe",                 &
              examples=["toygo -h       ",                 &
                        "toygo --version"],                &
              epilog="Good bye"
              disable_hv=.false.)

All dummy arguments are optionals, but the init must be always invoked before using the CLI object for safe initializing CLI attributes.

In the figure below a visual meaning of each dummy arguments is provided.

init

The following attributes are public, the user is allowed to directly use them:

character(len=:), public, allocatable :: progname      !< Program name.
character(len=:), public, allocatable :: version       !< Program version.
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        !< Epilog message.
character(len=:), public, allocatable :: m_exclude     !< Mutually exclude other CLA(s group).
character(len=:), public, allocatable :: error_message !< Meaningful error message.
integer(I4P),     public              :: error         !< Error traping flag.
Clone this wiki locally