---
epic: 11
story: 11.3
title: "Output Formats"
status: draft
---

## Epic 11 — CLI Tool
**Goal:** Command-line tool for scripting and automation, same Rust engine.

### Story 11.3: Output Formats

As a developer,
I want to control the output format of CalcPad results,
So that I can integrate results into different toolchains and data pipelines.

**Acceptance Criteria:**

**Given** the user runs calcpad without a `--format` flag
**When** the expression is evaluated
**Then** the output is in plain text format (default), showing only the result value and unit

**Given** the user runs `calcpad --format json "5kg in lbs"`
**When** the expression is evaluated
**Then** the output is valid JSON containing at minimum: `value`, `unit`, and `type` fields
**And** example output resembles `{"value": 11.023, "unit": "lbs", "type": "mass"}`

**Given** the user runs `calcpad --format csv` with multi-line stdin
**When** the input is evaluated
**Then** the output is CSV formatted with columns for line number, expression, value, and unit
**And** the output can be directly imported into spreadsheet software

**Given** the user specifies an unrecognized `--format` value
**When** the command is executed
**Then** an error message lists the valid format options (plain, json, csv)
**And** the process exits with code 1
