Command Line Options#

As well as setting options in the project file, you can set or override all of them on the command line. This is useful for integrating Ford into a build system for setting preprocessor defines, include paths, or the version number, for example.

Added in version 7.0: The --config flag can be used to set any option. It takes a TOML-formatted, semi-colon separated string, for example:

ford example-project-file.md --config="search=false; parallel=4"

ford - CLI interface#

Document a program or library written in modern Fortran. Any command-line options over-ride those specified in the project file.

ford [-h] [-d SRC_DIR] [-p PAGE_DIR] [-o OUTPUT_DIR] [-s CSS]
     [-r REVISION] [--exclude EXCLUDE] [--exclude_dir EXCLUDE_DIR]
     [-e EXTENSIONS] [-m MACRO] [-w] [-f] [-g] [--no-search] [-q] [-V]
     [--debug] [-I INCLUDE] [--externalize] [-L EXTERNAL]
     [--config CONFIG]
     project_file

ford positional arguments#

  • project_file - file containing the description and settings for the project

ford options#

  • -h, --help - show this help message and exit

  • -d SRC_DIR, --src_dir SRC_DIR - directories containing all source files for the project (default: ./src)

  • -p PAGE_DIR, --page_dir PAGE_DIR - directory containing static pages (default: None)

  • -o OUTPUT_DIR, --output_dir OUTPUT_DIR - directory in which to place output files (default: ./doc)

  • -s CSS, --css CSS - custom style-sheet for the output

  • -r REVISION, --revision REVISION - source code version number or revision of the project to document

  • --exclude EXCLUDE - list of files which should not be included in the documentation

  • --exclude_dir EXCLUDE_DIR - list of directories whose contents should not be included in the documentation

  • -e EXTENSIONS, --extensions EXTENSIONS - extensions which should be scanned for documentation (default: f90, f95, f03, f08)

  • -m MACRO, --macro MACRO - preprocessor macros (optionally with values) to be applied to preprocessed files

  • -w, --warn - display warnings for undocumented items

  • -f, --force - try to continue to read files even if there are fatal errors

  • -g, --graph - generate graphs for documentation output

  • -q, --quiet - suppress normal output

  • -V, --version - show program’s version number and exit

  • --debug - display traceback if fatal exception occurs and print faulty line

  • -I INCLUDE, --include INCLUDE - list of directories to be searched for include files

  • --externalize - provide information about Fortran objects in a json database for other FORD projects to refer to.

  • -L EXTERNAL, --external_links EXTERNAL -

    external projects to link to.

    If an entity is not found in the sources, FORD will try to look it up in those external projects. If those have documentation generated by FORD with the externalize option, a link will be placed into the documentation wherever this entity is referred to. FORD will look in the provided paths for a modules.json file.

  • --config CONFIG - Any other FORD options as a semicolon-separated TOML string. Options set through this have lower precedence than other command line options