CLI Usage
Purpose
Define the supported command-line interface for scripts/dsambayes.R, including required flags,
optional flags, and execution semantics.
Prerequisites
Before using the CLI:
- Complete Install and Setup.
- Run commands from repository root.
- Ensure DSAMbayes is installed and available in
R_LIBS_USER.
Entry point
The script supports these commands:
initvalidaterunhelp(or-h/--help)
Command summary
| Command | Required flags | Optional flags | Behaviour |
|---|---|---|---|
init |
--out |
--template, --overwrite |
Writes a config template file. |
validate |
--config |
--run-dir |
Runs config and data checks only (dry_run = TRUE). |
run |
--config |
--run-dir |
Executes the full pipeline (dry_run = FALSE) and writes run artefacts. |
help |
none | none | Prints usage text and exits. |
Flag reference
init
--out <path>(required): output path for the generated YAML file.--template <name>(optional): template name. Default isblm.- Supported values in script:
master,blm,re,cre,pooled,hierarchical. hierarchicalmaps to the same template file asre.
- Supported values in script:
--overwrite(optional flag): allow overwrite of an existing--outfile.
validate
--config <path>(required): YAML config path.--run-dir <path>(optional): explicit run directory path.
run
--config <path>(required): YAML config path.--run-dir <path>(optional): explicit run directory path.
Usage examples
Show help
Expected outcome: usage panel is printed with command syntax and notes.
Create a new config from template
Expected outcome: config/local_quickstart.yaml is created.
Validate only (dry-run behaviour)
Expected outcome: validation completes without fitting Stan models.
Validate with explicit run directory
Expected outcome: validation uses the provided run directory path when writing run metadata.
Execute full run
Expected outcome: full modelling pipeline executes and artefacts are written under results/.
Execute full run with explicit run directory
Expected outcome: artefacts are written to results/quickstart_run (subject to overwrite rules in config).
Exit and error behaviour
- Success exits with status
0. - CLI argument or runtime errors exit with status
2. - Typical hard failures include:
- DSAMbayes not installed.
- Missing required flags (
--outor--config). - Unknown command.
- Unknown argument format.
Operational notes
validateis the recommended pre-run gate. Use it beforerunwhenever you change config or data.runprints a run summary and suggested next-step artefacts at completion.- The CLI itself does not define model semantics. It delegates execution to
DSAMbayes::run_from_yaml().