-
Notifications
You must be signed in to change notification settings - Fork 34
Getting Started
To start using FLAP and declaring your CLI, you must import its main module:
use flap
This module exposes only one object, namely command_line_interface
.
To start using FLAP you must obviously define a CLI object:
type(command_line_interface):: cli
Now that you have your CLI declared you can start using it. The API to handle it follows.
The main CLI object, that is the only one you must know, is a command_line_interface object. It has all attributes necessary for its internal operations defined as private, thus you should not care about them. The interaction with the library is safely performed by means of only the public methods available. However, some useful attributes are public in order to facilitates some minor tasks (e.g. printing authors list).
Essentially, for building up and using a minimal CLI you should follow the 4 steps:
type(command_line_interface):: cli
call cli%add(switch='-o', help='Output file name', def='myfile.md', error=error)
call cli%parse(error=error)
This step is optional, namely the explicit call to parse
method is optional: the first time you will call the get
method the parsed status of the CLI is checked and, if necessary, the parse
method is automatically called inside the get
method.
call cli%get(switch='-o', val=OutputFilename, error=error)
OutputFilename and error being previously defined variables.
Assuming that you have stated:
USE Data_Type_Command_Line_Interface
type(Type_Command_Line_Interface):: CLI
the following are the complete APIs of all public CLI methods
- free
- init
- add_group
- set_mutually_exclusive_groups
- add
- parse
- get
- get_varying
- is_passed
- is_defined_group
- is_defined
- run_command
- print_usage
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.
Home | About | Getting Started Guide | Usage | Copyright © 2016 szaghi