← Back to issue list

Utility to allow a `format` option for commands.

View original Github issue

Metadata

Project
craft-application
Number
#342
Type
issue
State
open
Author
lengau
Labels
—
Created
Updated
Closed
—

Current evaluation

A maintainer-authored request for reusable table and JSON output helpers remains unimplemented and untriaged in the current codebase.

Suggested action: needs triage

Reason: The body provides concrete helper names, a parser integration point, and minimum table and JSON requirements. Current source has neither add_format_argument nor emit_formatted_output, and the issue has no labels or maintainer response beyond an automated comment, so it is valid but still needs prioritization.

Evaluated by: mr-cal-bot

Impact: 49 Quick Win: 22 Complexity: 42 Confidence: 92 Actionability: 76

Issue body

### What needs to get done Add utilities of some form to make it easy for commands to add a unified `format` option for various tabular command outputs. Ideally a command's `fill_parser` method would be able to do something like: ``` utils.add_format_argument(parser) ``` and then we'd have a related function that actually emits the formatted message, something like: ``` def emit_formatted_output(format: FormatValue, headers: Sequence[str], data) -> None: ... ``` Here the `data` object would need to be something that can (at minimum) be used by [tabulate](https://pypi.org/project/tabulate/) and be serialised into JSON. With those two formats, we'd likely get the ability to do other formats (e.g. YAML, toml) if we decide to add that in the future. ### Why it needs to get done This got added to the `names` command in snapcraft recently: https://github.com/canonical/snapcraft/pull/4778 Charmcraft has a [partial implementation](https://github.com/canonical/charmcraft/blob/e2ad204f828a4ef387090d3e626f0f6db34e5996/charmcraft/application/commands/base.py#L33), but still relies on the command itself being aware of each format.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 49
Quick Win: 22
Complexity: 42
Confidence: 92
Actionability: 76
needs triage A maintainer-authored request for reusable table and JSON output helpers remains unimplemented and untriaged in the current codebase.
qwen/qwen3.6-35b-a3b
Impact: 60
Quick Win: 21
Complexity: 50
Confidence: 70
Actionability: 70
needs triage Feature request to add utility functions for unified `format` option across commands. No maintainer assessment, unlabelled, proposed API not implemented in codebase.
qwen/qwen3.8-27b
Impact: 35
Quick Win: 19
Staleness: 72
Complexity: 45
Confidence: 78
Support Request: 0
needs triage Feature request from maintainer lengau to add a unified format option utility (add_format_argument, emit_formatted_output) for tabular command outputs. No labels, no implementation found in codebase, last activity was a bot Jira ticket 465 days ago.
qwen/qwen3.6-35b-a3b
Staleness: 75
Complexity: 60
Confidence: 85
Support Request: 10
needs triage Feature request to add a unified `format` option utility for commands, enabling consistent tabular output formatting across the project. Currently unlabelled and awaiting triage.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 30
Confidence: 80
Support Request: 10
needs triage Feature request to create a utility for a unified format CLI option across commands, enabling tabular output in JSON, YAML, TOML, etc. Open since 2023 with minimal maintainer interaction and an internal Jira ticket linked.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/snapcraft#4778 (confidence 98%)

    The cited names-command change added format handling and motivated the request for a shared cross-command utility.

Related issues

No related issues found above the similarity threshold.