Options & input processing for modern Fortran
Fortran Shell Makefile
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Options and input processing for Fortran

options.f90 is a Fortran module for defining and parsing command-line options and input parameters for Fortran programs. Its design is inspired by Python's optparse module. Some features:

  • Allows definition of options/parameters (real, integer, logical, string, and flags) corresponding to natural Fortran types, with names and descriptions

  • Automates reading option values from the command line and input parameters from file

  • Supports long options (e.g. --myopt) and short options (-m), as well as combining several short options (e.g. -v -c is the same as -vc)

  • Performs rigorous input validation & other error checking

  • Supports default values for all option types, and lower & upper bounds on numerical options

  • Can print nice descriptions of available options, with line wrapping as necessary

  • Designed to be easily extended with new option types

  • Well-tested and carefully coded (much of the code has been formally verified)

  • Easy to use

For more info, see http://infty.net/options/options.html

To Do

Some goals for future versions of this library:

  1. Include support for commands, rather than just options, on the command line.

  2. Create a mechanism for automatically generating a help message, given a short description of the program.