.. _dip-cli: Command line ============ Parse, compare, save, export, and report DIPL environments. Basic examples -------------- With ``snt`` on ``PATH``, evaluate text and print a scalar: .. code-block:: bash snt dip parse --input string "steps int = 100" --request steps --value --type integer # 100 Tune the same input with an override: .. code-block:: bash snt dip parse --input string "steps int = 100" \ --input override_string "steps = 200" --request steps --value --type integer # 200 Common workflows ---------------- .. list-table:: :header-rows: 1 * - Task - Command chain - Output * - Parse and inspect - ``snt dip parse``; ``describe``; ``list``; ``entries`` - Text or JSON records * - Save and restore - ``parse --save``; ``parse --load`` - DIPH5 snapshot * - Export parameters - ``parse --generate FORMAT FILE`` - Generated source or data file * - Preview overrides - ``snt dip preview --override ...`` or ``--override-file`` - Candidate validation and comparison * - Compare snapshots - ``snt dip compare before.diph5 after.diph5 --scope effective|full`` - Summary and indexed differences * - Generate a report - ``snt report --project DIPfile --format ... --output FILE`` - Report file * - Package for the web - ``snt dip package --project DIPfile --output FILE`` - Project bundle JSON * - Maintain source - ``snt dip format``; ``validate``; ``lint`` - Check/write result or diagnostics .. code-block:: bash snt dip parse --project DIPfile --print --save run.diph5 snt dip describe --project DIPfile --path physics.speed --format json snt dip list --project DIPfile --query '?physics.' --format json snt dip preview --project DIPfile --override 'physics.speed = 3 m/s' \ --format json snt dip compare before.diph5 run.diph5 --scope full snt report --project DIPfile --format html --output report.html snt dip package --project DIPfile --output project.bundle.json snt dip format --check parameters.dip snt dip validate DIPfile snt dip lint --json parameters.dip Each command evaluates its input independently; no environment persists between invocations. Use ``--print``, ``--request``, ``--value``, or ``--format json`` to make machine-readable output. Errors go to stderr and return a nonzero status, so shell pipelines can test the command directly. ``snt dip docs`` prints the embedded DIPL language reference by chapter or heading, for example ``snt dip docs expressions#templates``. **DIPL developer tools.** The CLI exposes the complete maintenance workflow: .. code-block:: bash snt dip format --check parameters.dip snt dip format --write parameters.dip snt dip validate DIPfile snt dip lint --json parameters.dip See the :doc:`CLI guide <../../../integrations/cli>` for parsing, setup, persistence, export, and reports, and the :doc:`DIPL developer tools <../../../integrations/devtools>` page for formatter, validator, and linter settings. Current limitations and differences ----------------------------------- Compared with the canonical C++ implementation: - Each command loads and evaluates its input independently; callers receive text or JSON instead of a persistent C++ Environment or Inspector. - Custom value/node callbacks cannot be registered from command arguments. Register them in C++ or Python when embedding DIP in an application. - Parsing, source validation, formatting, linting, guided setup, reports, and experiment recording have CLI commands. The C++ source-editing session APIs have no direct CLI counterpart; use the viewer or embed those APIs. Command reference ----------------- This is a command lookup, not a set of examples to run in order. Use `Common workflows` above to choose a task, then find the exact invocation below. Run ``snt dip --help`` for the current option list. Project and source commands ~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ``snt dip init`` initializes a project in the current directory. - ``snt dip setup [--output FILE]`` builds an override through guided prompts. - ``snt dip docs [--list | CHAPTER | CHAPTER#HEADING]`` reads the embedded language reference. - ``snt dip package --project [--output FILE] [--include FILE ...]`` creates a browser project bundle. - ``snt dip experiment `` records a DIPH5 execution lifecycle. Evaluation and persistence ~~~~~~~~~~~~~~~~~~~~~~~~~~ - ``snt dip parse`` accepts repeated ``-i/--input`` registrations: ``file``, ``string``, ``override_string``, ``override_file``, ``unit``, ``source``, ``schema_string``, and ``schema_file``. - ``snt dip parse --project `` loads a project; ``--load `` restores a snapshot. - ``--request/-r``, ``--print``, ``--value``, ``--type``, ``--record-graph``, ``--save``, and ``--generate`` control output and persistence. - ``snt dip compare [--scope ...]`` compares snapshots. Inspection commands ~~~~~~~~~~~~~~~~~~~ - ``snt dip describe --project --path [--format json]``. - ``snt dip schemas --project [--format json]``. - ``snt dip sources --project [--format json]``. - ``snt dip override-contract --project --path ``. - ``snt dip list --project [--query QUERY] [--limit N]``. - ``snt dip entries --project --path ``. - ``snt dip records --input --collection [--where-eq ...]``. - ``snt dip preview --project --override-file ``. - ``snt dip format --check|--write [ ...]``. - ``snt dip validate [--project] [--json] [ ...]``. - ``snt dip lint [--project] [--json] [ ...]``. Reports ~~~~~~~ - ``snt report --project --format tex|pdf|md|rst|html|typ|txt|json --output ``. - ``snt report --load ...`` renders from a snapshot. - ``--intro``, ``--title``, ``--author``, ``--date``, ``--report-version``, ``--tex-compiler``, and ``--cheatsheet-pdf`` control report output.