Skip to content

zoo kcl format --format yaml|table exits 0 with empty stdout #1751

Description

@sneg55

zoo kcl format --format yaml (and table) exits 0 with empty stdout

Context: API Makeathon participant. Found while reviewing the kcl format command.

FormatOutput accepts json, yaml, and table (src/types.rs:7-11), and zoo kcl format accepts all three (src/cmd_kcl.rs:244-246). But the run impl only writes output for JSON or the default formatted-source branch (src/cmd_kcl.rs:284-291). Selecting yaml or table enters the Some(format) branch, fails the JSON check, and skips the default-output branch, so nothing is printed.

Concrete failure

zoo kcl format - --format yaml (or --format table) succeeds with exit code 0 and produces no output at all. A user or script asking for a non-JSON format silently gets nothing, with no error to indicate the format is unsupported here.

Verify

Pipe valid KCL into the yaml and table variants and compare stdout with the no-format variant: the former are empty while exit status is 0.

Suggested fix

Either handle yaml/table in the format command (or fall through to the default formatted output), or reject the unsupported values with a clear error instead of exiting 0 with no output.

Environment

Zoo CLI v0.2.184 (33534cd). Reviewed against the current main of KittyCAD/cli.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions