-
Notifications
You must be signed in to change notification settings - Fork 34
CLI Method parse
Signature
call clI%parse(pref, args, error)
Parse Command Line Interfaces. All dummy arguments are optional.
character(*), optional, intent(in) :: pref !< Prefixing string.
character(*), optional, intent(in) :: args !< String containing command line arguments.
integer(I4P), optional, intent(out) :: error !< Error trapping flag.
If the args argument is passed the command line arguments are taken from it and not from the actual program CLI invocation.
Must be used for parsing the arguments values passed to the program CLI invocation. Note that all the values are saved as strings during this phase (all leading and trailing white spaces are removed from the values): the casting to the user-actual-type is done from the get
method. During this parsing the default (or environmental values) are flushed to the arguments values if necessary.
use flap
type(command_line_interface):: cli
integer:: error
call cli%init(...)
call cli%add(...)
! parse the arguments values
call cli%parse(error=error) ; if (error/=0) stop
...
For trapping errors the dummy argument error
can be used. The complete errors values are listed in Errors-codes.
Note that the explicit call to the parse
method is optional: the first time you will call the get
method, the parsed status of
the CLI is checked and, if necessary, it automatically calls the parse
one.
Home | About | Getting Started Guide | Usage | Copyright © 2016 szaghi