.. _puq-cli: Command line ============ The ``snt puq`` commands evaluate expressions, convert units, inspect quantities, and list unit definitions. Basic examples -------------- With ``snt`` on ``PATH``, evaluate an expression: .. code-block:: bash snt puq eval "23*cm + 3*m" Convert to the units needed by a script: .. code-block:: bash snt puq convert "2.5*m" "cm" # 250*cm Common workflows ---------------- .. list-table:: :header-rows: 1 * - Task - Command chain - Output * - Evaluate an expression - ``snt puq eval`` - Formatted quantity on stdout * - Convert for a script - ``snt puq convert`` - Formatted target quantity on stdout * - Inspect dimensions and units - ``snt puq info`` - Multi-line report on stdout * - Discover unit definitions - ``snt puq list`` - Text or JSON listing on stdout * - Fail safely in automation - Any command - Error on stderr and nonzero exit status .. code-block:: bash snt puq eval "23*ft + 3*yd" -s US -S SI -U cm snt puq info "23*kg*m2/s2" snt puq list deriv -s IU Use ``-s`` for the input unit system, ``-S`` for the output system, and ``-Q`` for conversions that need a physical-quantity context: .. code-block:: bash snt puq convert "12*statA" "A" -s ESU -S SI -Q "I" See the :doc:`CLI guide <../../../integrations/cli>` for installation, shell-script usage, and the other command groups. Current limitations and differences ----------------------------------- Compared with the canonical C++ implementation: - Each invocation evaluates independently and returns text; it does not retain native Quantity objects for subsequent calls. - The CLI exposes evaluation, conversion, inspection, and listings. It has no commands for assigning correlations, Monte Carlo sampling, or extending EXS operators from host code. - Errors use stderr and a nonzero exit status rather than C++ exceptions. Use C++ or Python when calculations need typed in-memory results. 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 puq -h`` or ``snt puq -h`` for the current option list. - ``snt puq eval `` evaluates with optional ``-s/--input-system``, ``-S/--output-system``, ``-U/--output-units``, and ``-Q/--output-quantity``. - ``snt puq convert `` converts with the same input, output-system, and output-quantity options. - ``snt puq info `` prints dimensions, units, value, and uncertainty information; ``-s/--system`` selects the input system. - ``snt puq list `` accepts ``prefix``, ``base``, ``deriv``, ``log``, ``temp``, ``const``, ``quant``, and ``sys``; ``-s/--system`` selects the listing system.