Skip to content

feat(cli): add --output-file flag to ado get#838

Merged
michael-johnston merged 2 commits into
mainfrom
ap_824_add_output_file_to_ado_get
Apr 13, 2026
Merged

feat(cli): add --output-file flag to ado get#838
michael-johnston merged 2 commits into
mainfrom
ap_824_add_output_file_to_ado_get

Conversation

@AlessandroPomponio
Copy link
Copy Markdown
Member

Summary

Adds support for writing ado get command output to a file using the new --output-file option. 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.py

Added a new --output-file command-line option to the get_resource command 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.py

Added output_file field (type: pathlib.Path | None) to the AdoGetCommandParameters model to support passing the output file path through the command execution pipeline.

📄 orchestrator/cli/utils/resources/handlers.py

Modified handle_ado_get_special_formats function to write formatted output to a file when output_file is 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.

Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
@michael-johnston michael-johnston added this pull request to the merge queue Apr 13, 2026
Merged via the queue into main with commit 512cc11 Apr 13, 2026
19 checks passed
@michael-johnston michael-johnston deleted the ap_824_add_output_file_to_ado_get branch April 13, 2026 17:48
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.

feat(cli): add --output-file flag to commands that don't have it

2 participants