Skip to content

feat(cli): allow using --output-file with all output types #859

Merged
AlessandroPomponio merged 5 commits intomainfrom
ap_839_remove_output_file_restrictions
Apr 16, 2026
Merged

feat(cli): allow using --output-file with all output types #859
AlessandroPomponio merged 5 commits intomainfrom
ap_839_remove_output_file_restrictions

Conversation

@AlessandroPomponio
Copy link
Copy Markdown
Member

@AlessandroPomponio AlessandroPomponio commented Apr 15, 2026

Summary

This pull request removes redundant output format validation logic from CLI commands and enhances output file handling to support writing table format to files. Previously, validation prevented using --output-file with certain display formats (like table, console, default, and name), but this restriction has been removed to allow more flexible output options.

Resolves #839 and closes #788

Files Changed

📄 orchestrator/cli/commands/get.py

Removed validation that prevented using --output-file with DEFAULT and NAME output formats. This restriction is no longer necessary as the output handlers now properly support file output for all formats.

📄 orchestrator/cli/commands/show_entities.py

Removed validation that prevented using --output-file with TABLE output format. File output is now supported for table format.

📄 orchestrator/cli/commands/show_requests.py

Removed validation that prevented using --output-file with TABLE output format for the show requests command.

📄 orchestrator/cli/commands/show_results.py

Removed validation that prevented using --output-file with TABLE output format for the show results command.

📄 orchestrator/cli/commands/show_summary.py

Removed validation that prevented using --output-file with MARKDOWN and TABLE output formats for the show summary command.

📄 orchestrator/cli/utils/output/dataframes.py

Enhanced the df_to_output function to support writing table format to files. When outputting to a file, tables are now rendered to string format using render_to_string with automatic width. Column truncation is automatically disabled when writing to files. Also added proper handling for empty JSON output.

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

Refactored output handling in multiple format handlers (_handle_name_format, _handle_table_format) to use the centralized _write_or_print_output helper function. Enhanced _write_or_print_output to accept both string content and rich renderables, automatically converting renderables to strings when writing to files. This ensures consistent file output behavior across all format types.

Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Comment thread orchestrator/cli/utils/resources/handlers.py Outdated
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
@AlessandroPomponio AlessandroPomponio added this pull request to the merge queue Apr 16, 2026
@AlessandroPomponio AlessandroPomponio removed this pull request from the merge queue due to a manual request Apr 16, 2026
@AlessandroPomponio AlessandroPomponio added this pull request to the merge queue Apr 16, 2026
Merged via the queue into main with commit 78709a7 Apr 16, 2026
19 checks passed
@AlessandroPomponio AlessandroPomponio deleted the ap_839_remove_output_file_restrictions branch April 16, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants