Skip to content

feat(cli): add --output to workspace create and get - #4620

Open
politerealism wants to merge 1 commit into
NVIDIA:mainfrom
politerealism:feat/cli-workspace-output/politerealism
Open

politerealism wants to merge 1 commit into
NVIDIA:mainfrom
politerealism:feat/cli-workspace-output/politerealism

Conversation

@politerealism

Copy link
Copy Markdown
Contributor

Summary

workspace list and workspace member list accept --output json|yaml, but workspace get and workspace create only print human-readable text. Anything that needs the result has to parse that text. This adds the same -o/--output flag to both, using the existing workspace JSON shape. The default table output doesn't change.

Related Issue

No separate issue: this closes a small gap in existing structured output. The conformance workspace stories in #4607 currently check text for the same reason.

Changes

  • workspace create and workspace get take -o/--output table|json|yaml, defaulting to table.
  • Both print the workspace through the shared print_output_single helper and workspace_to_json, so the fields match workspace list.
  • Add a parse test for both flags.
  • Update docs/how-it-works/workspaces.mdx to cover all three commands and show get --output json.

Testing

  • mise run pre-commit passes
  • cargo test -p openshell-cli --bin openshell workspace passes, including the new parse test
  • Live, against a rootless Podman gateway built from this branch (e2e/with-podman-gateway.sh): create and get with -o json return the same name, id, labels and Active status; -o yaml works on both; the default text output of both is unchanged; -o xml is rejected; get of a missing workspace and a duplicate create with -o json fail and print nothing on stdout. A deliberate-failure run (expecting Terminating for a new workspace) failed only that check.
  • Not run: other drivers or macOS

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Docs updated
  • Architecture docs updated (not applicable)

`workspace list` and `workspace member list` accept `--output json|yaml`,
but `workspace get` and `workspace create` only printed human-readable
text, so scripts and tests had to parse it. Add the same `-o/--output`
flag to both, using the existing workspace JSON shape. The default table
output is unchanged.

Signed-off-by: politerealism <burdcat17@gmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Oct 15, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant