Skip to content

fetch command

Fetch GitHub-hosted Fortran dependencies listed in the fobos [dependencies] section and wire them into the build automatically.

bash
fobis fetch [options]

After fetching, run fobis build as usual — it automatically picks up the fetched dependencies.

Options

OptionDefaultDescription
--deps-dir DIR.fobis_depsDirectory where dependencies are cloned (overrides deps_dir in fobos [dependencies])
--updateFalseRe-fetch (git pull / checkout) and rebuild existing dependencies
--no-buildFalseClone only — skip building even for use=fobos dependencies

fobos options

OptionDescription
-f, --fobosSpecify a fobos file with a different name or path
--fci, --fobos-case-insensitiveCase-insensitive fobos option parsing
--modeSelect a fobos mode — tab-completable from the active fobos file
--lmodesList available modes and exit
--print-fobos-templatePrint a fobos template

Fancy options

OptionDescription
--colorsColoured terminal output
-l, --logWrite a log file
-q, --quietLess verbose output
--verboseMaximum verbosity
--jsonEmit structured JSON to stdout (see JSON output)

fobos [dependencies] section

Declare dependencies in your fobos file using the [dependencies] section:

ini
[dependencies]
deps_dir = .fobis_deps                          # optional — same as --deps-dir
penf     = https://github.com/szaghi/PENF :: tag=v1.5.0
stdlib   = https://github.com/fortran-lang/stdlib :: tag=v0.5.0 :: use=fobos :: mode=gnu
jsonfort = https://github.com/jacobwilliams/json-fortran :: branch=main :: use=fobos
utils    = https://github.com/certik/fortran-utils :: rev=a1b2c3d
simple   = https://github.com/user/repo

Each dependency entry has the form:

name = URL [:: branch=X] [:: tag=X] [:: rev=X] [:: mode=X] [:: use=sources|fobos]
PartDescription
nameShort identifier — used as the subdirectory name under deps_dir
URLFull HTTPS URL of the Git repository
branch=XCheckout a specific branch
tag=XCheckout a specific tag
rev=XCheckout a specific commit SHA
mode=Xfobos mode to use when building the dependency (only for use=fobos)
use=XIntegration mode: sources (default) or fobos

Only one of branch, tag, or rev may be specified. If none is given, the default branch is used.

deps_dir key

Setting deps_dir in the [dependencies] section is equivalent to passing --deps-dir on the command line. The CLI flag takes precedence when both are provided.

use= integration modes

use=fobis fetch behaviourfobis build behaviour
sources (default)Clone only, no pre-buildDep directory added to source scan; sources compiled inline with your project
fobosClone + fobis build inside depDep fobos path added to --dependon; dep dir excluded from source scan; dep library linked

For use=fobos the target repository must contain a fobos file. For use=sources no fobos file is required.

How it works

  1. For each entry in [dependencies], fetch clones the repository into <deps-dir>/<name>/.
  2. If branch, tag, or rev is specified, the corresponding revision is checked out.
  3. For use=fobos dependencies (and when --no-build is not set), fobis build is invoked inside the dependency directory using the specified mode.
  4. A config file <deps-dir>/.deps_config.ini is written:
    • use=sources deps → listed under the src key
    • use=fobos deps → listed under the dependon key
  5. When you run fobis build, it reads .deps_config.ini:
    • src entries are appended to the source search paths (skipped if already covered)
    • dependon entries are added to --dependon, and the dep directory is added to --exclude-dirs to prevent double-compilation

Fetch dependencies demo

Workflow

bash
# 1. Add [dependencies] to your fobos file (see above)

# 2. Fetch all dependencies
fobis fetch

# 3. Build your project — dependencies are auto-detected
fobis build

# 4. Update dependencies to their latest version
fobis fetch --update

# 5. Clone only (inspect before building)
fobis fetch --no-build
fobis fetch --no-build --update   # re-fetch without rebuilding

Examples

bash
# Fetch all dependencies defined in the fobos file
fobis fetch

# Fetch into a custom directory
fobis fetch --deps-dir vendor/

# Re-fetch and rebuild
fobis fetch --update

# Clone only, do not build
fobis fetch --no-build

# Use a custom fobos file
fobis fetch -f my.fobos

See the Fetch Dependencies advanced guide for the full workflow and integration mode details.