Repository navigation
feat(cli): add --output to workspace create and get - #4620
Open
politerealism wants to merge 1 commit into
Open
politerealism wants to merge 1 commit into
politerealism wants to merge 1 commit into
Conversation
`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>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
workspace listandworkspace member listaccept--output json|yaml, butworkspace getandworkspace createonly print human-readable text. Anything that needs the result has to parse that text. This adds the same-o/--outputflag 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 createandworkspace gettake-o/--output table|json|yaml, defaulting totable.print_output_singlehelper andworkspace_to_json, so the fields matchworkspace list.docs/how-it-works/workspaces.mdxto cover all three commands and showget --output json.Testing
mise run pre-commitpassescargo test -p openshell-cli --bin openshell workspacepasses, including the new parse teste2e/with-podman-gateway.sh):createandgetwith-o jsonreturn the same name, id, labels andActivestatus;-o yamlworks on both; the default text output of both is unchanged;-o xmlis rejected;getof a missing workspace and a duplicatecreatewith-o jsonfail and print nothing on stdout. A deliberate-failure run (expectingTerminatingfor a new workspace) failed only that check.Checklist