Modern Fortran standards (2003+) have introduced support for Command Line Arguments (CLA), thus it is possible to construct nice and effective Command Line Interfaces (CLI). FLAP is a small library designed to simplify the (repetitive) construction of complicated CLI in pure Fortran (standard 2003+). FLAP has been inspired by the python module argparse trying to mimic it. Once you have defined the arguments that are required by means of a user-friendly method of the CLI, FLAP will parse the CLAs for you. It is worthy of note that FLAP, as argparse, also automatically generates help and usage messages and issues errors when users give the program invalid arguments.
The features:
- User-friendly methods for building flexible and effective Command Line Interfaces (CLI);
- comprehensive Command Line Arguments (CLA) support:
- support optional and non optional CLA;
- support boolean CLA;
- support positional CLA;
- support list of allowable values for defined CLA with automatic consistency check;
- support multiple valued (list of values, aka list-valued) CLA:
- compiletime sized list, e.g.
nargs='3'
; - runtime sized list with at least 1 value, e.g.
nargs='+'
; - runtime sized list with any size, even empty, e.g.
nargs='*'
;
- compiletime sized list, e.g.
- support mutually exclusive CLAs;
- self-consistency-check of CLA definition;
- support fake CLAs input from a string;
- support fake CLAs input from environment variables;
- comprehensive command (group of CLAs) support:
- support nested subcommands;
- support mutually exclusive commands;
- self-consistency-check of command definition;
- automatic generation of help and usage messages;
- consistency-check of whole CLI definition;
- errors trapping for invalid CLI usage;
- POSIX style compliant;
- automatic generation of MAN PAGE using your CLI definition!;
- replicate all the useful features of argparse;
- implement docopt features.
- implement click features.
No comments:
Post a Comment