Skip to content
Go to file

Latest commit

  - Correctly set default values when using var=... parameter to define_option.

  - Add a couple of tests

  - Don't print "option not found" error message when the user passes -h and the
    programmer has set a help routine.

Git stats


Failed to load latest commit information.
Latest commit message
Commit time
Mar 22, 2015
Mar 22, 2015
May 24, 2013

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

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.


Options & input processing for modern Fortran



No releases published


No packages published
You can’t perform that action at this time.