feat(cli): add support for -o in ado contexts#821
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 10, 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
This PR refactors the
ado contextscommand to improve its output formatting and consistency. The main changes include:--simpleflag with a more flexible--output/-ooption that supports multiple formats (default, name, yaml, json)Resolves #817
Files Changed
📄
orchestrator/cli/commands/context.pyRefactored the
list_contextsfunction to replace the boolean--simpleflag with a more flexible--output/-ooption that accepts different output formats (default, name, yaml, json). Updated the command documentation with better examples showing the new output format options. Removed the separate logic for displaying the active context message and simplified the function by delegating output formatting to theget_contextfunction. Also cleaned up excessive blank lines in docstrings.📄
orchestrator/cli/resources/context/get.pyRemoved the
simplify_outputparameter and refactored output handling to use theoutput_formatparameter consistently. Renamed "DEFAULT" column to "ACTIVE" in the context dataframe for better clarity. Improved error handling for invalid contexts with more helpful error messages including file paths and remediation hints. Simplified the NAME format output logic and removed the now-unused_simple_contexts_formattingfunction. Updated comments to better describe the behavior.📄
orchestrator/cli/utils/output/prints.pyAdded a new constant
ADO_NO_CONTEXT_AVAILABLE_ERRORto centralize the error message displayed when no contexts are available, improving consistency and maintainability across the codebase.📄
tests/ado/context/test_ado_context.pyUpdated all test cases to use the new
--output name/-o nameoption instead of the deprecated--simpleflag. Renamed test variables from*_simple_output_*to*_name_output_*to reflect the new naming convention. All test assertions remain functionally equivalent but now test the new interface.