Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
263 changes: 150 additions & 113 deletions docs/cli/reference.mdx

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion docs/cli/working-with-resources.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This page covers how to list, view, and create resources with the CLI.

## Output Formats

Control how output is displayed with the `--output-format` (or `-f`) option.
Control how output is displayed with the `--output-format` (or `--output`, `-f`) option.

### Table (Default for Lists)

Expand All @@ -26,6 +26,12 @@ nemo workspaces list -f json
nemo workspaces get default -f json | jq '.id'
```

For list commands, add `--stream` with JSON or raw output to emit one newline-delimited JSON record per item:

```bash
nemo workspaces list --output json --stream | jq -c '.'
```

### YAML

YAML output, useful for configuration files:
Expand Down
2 changes: 1 addition & 1 deletion docs/fern/snippets/_snippets/cli-summary.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: ""
| Option | Description |
|--------|-------------|
| `--base-url` | Base URL for the NeMo Platform API |
| `--output-format, -f <CHOICE>` | Output format for how results are printed. [possible values: table, json, yaml, markdown, csv, raw, code] |
| `--output-format, --output, -f <CHOICE>` | Output format for how results are printed. [possible values: table, json, yaml, markdown, csv, raw, code] |
| `--no-truncate` | Don't truncate long values in table/markdown/csv output |
| `--timestamp-format <CHOICE>` | Timestamp format for table/markdown/csv output [possible values: relative, iso8601] |
| `--verbose, -v` | Enable verbose messaging. This only impacts logs that are visible, it doesn't change any data outputs. |
Expand Down
4 changes: 3 additions & 1 deletion packages/nemo_platform_ext/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ nemo workspaces get my-workspace --output-format code

## Output Formats

Supports multiple output formats via `--output-format` / `-f`:
Supports multiple output formats via `--output-format` / `--output` / `-f`:

- **table** (default) - Rich-formatted table with borders and colors
- **json** - Syntax-highlighted JSON
Expand All @@ -207,6 +207,8 @@ Supports multiple output formats via `--output-format` / `-f`:
- **code** - Python SDK code equivalent
- **raw** - Compact JSON without formatting

For list commands, combine `--stream` with `--output json` or `--output raw` to emit one newline-delimited JSON record per item.

## Output Columns

Customize columns in list commands with `--output-columns`:
Expand Down
12 changes: 10 additions & 2 deletions packages/nemo_platform_ext/src/nemo_platform_ext/cli/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import logging
from importlib.metadata import EntryPoint
from typing import TYPE_CHECKING, Annotated
from typing import TYPE_CHECKING, Annotated, cast

import typer

Expand All @@ -24,6 +24,7 @@
TopLevelEntry,
build_top_level_entries,
)
from nemo_platform_ext.config.types import OutputFormat as ConfigOutputFormat

if TYPE_CHECKING:
from nemo_platform_plugin.cli import NemoCLI
Expand Down Expand Up @@ -173,6 +174,7 @@ def main(
ListOutputFormat | None,
typer.Option(
"--output-format",
"--output",
"-f",
help="Output format for how results are printed.",
rich_help_panel="Global Options",
Expand Down Expand Up @@ -242,6 +244,12 @@ def main(
[green]Examples:[/]
nemo workspaces list --output-format markdown
nemo workspaces get default -f json

[green]Exit codes:[/]
- 0: Success
- 1: Local or unexpected error
- 2: Command usage error
- 3: Remote/API error
"""
# Lazy imports for performance (avoid loading pydantic_settings for --help)
from nemo_platform_ext.cli.core.context import CLIContext
Expand Down Expand Up @@ -274,7 +282,7 @@ def main(
if base_url is not None:
overrides["base_url"] = base_url
if output_format is not None:
overrides["output_format"] = output_format
overrides["output_format"] = cast(ConfigOutputFormat, output_format)
elif agent_mode:
overrides["output_format"] = "markdown"
if timestamp_format is not None:
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading