Skip to content

--status glues a detail's value onto its label when the label is 14+ characters: "Power assertion:held", "Inhibitor path:/usr/bin/systemd-inhibit" #75

Closed

Description

@matt-edmondson

What's wrong

StatusReport.AppendRow pads the label to a fixed 15 columns (StatusReport.cs:21, :56-57):

private const int LabelWidth = 15;
...
report.AppendLine($"{(label + ':').PadRight(LabelWidth)}{value}");

PadRight never adds a minimum gap. Once label + ':' reaches 15 characters, the value is appended directly after the colon. Labels come from .Status(string label, Func<string> value) and are chosen by the tool author, so any label of 14 or more characters triggers this.

Reproduction

.Status("Power assertion", () => "held")
.Status("Inhibitor path", () => "/usr/bin/systemd-inhibit")

Run tool --status:

State:         on
Power assertion:held
Inhibitor path:/usr/bin/systemd-inhibit
  • Expected: at least one space between label and value, with the value column aligned for every row.
  • Why it matters: --status is the diagnostic report users paste into bug reports. Glued rows are hard to read, and anything that splits rows on ": " gets the wrong value.

This is the same class of bug as #56, but in different code: HelpText.AppendRow vs StatusReport.AppendRow. Fixing #56 doesn't touch this.

Suggested fix

  • Compute the label column from the rows actually being printed: width = max(15, longestLabel + 2) across the fixed rows (Platform, Tray icon, State) and the details.
  • At minimum, pad to Math.Max(LabelWidth, label.Length + 2).
  • Acceptance: a StatusReportTests case with a 15-character detail label asserts a space between : and the value, and that every row's value starts in the same column.

Activity

  1. matt-edmondson commented on Nov 2, 2026

    @matt-edmondson
    ContributorAuthor

    Triage


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions