feat(cli): add --output-file flag to ado get#838
Merged
Conversation
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
michael-johnston
approved these changes
Apr 13, 2026
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
Adds support for writing
ado getcommand output to a file using the new--output-fileoption. This enhancement allows users to save resource information directly to a file instead of stdout, improving automation and scripting capabilities.Resolves #824
Files Changed
📄
orchestrator/cli/commands/get.pyAdded a new
--output-filecommand-line option to theget_resourcecommand that accepts a file path for writing output. Includes validation logic to ensure the option is only used with file-based output formats (yaml, json, config) and raises an error if used with incompatible formats (default, name). The output file parameter is then passed to the resource handler.📄
orchestrator/cli/models/parameters.pyAdded
output_filefield (type:pathlib.Path | None) to theAdoGetCommandParametersmodel to support passing the output file path through the command execution pipeline.📄
orchestrator/cli/utils/resources/handlers.pyModified
handle_ado_get_special_formatsfunction to write formatted output to a file whenoutput_fileis specified in parameters. When a file is provided, the content is written to disk and a success message is displayed to stderr; otherwise, output is printed to stdout as before.