Skip to content

fix: repair --format help text in CLI - #785

Open
Socialpranker wants to merge 1 commit into
sabre-io:masterfrom
Socialpranker:fix/help-format-list
Open

fix: repair --format help text in CLI#785
Socialpranker wants to merge 1 commit into
sabre-io:masterfrom
Socialpranker:fix/help-format-list

Conversation

@Socialpranker

Copy link
Copy Markdown

Disclosure: this patch was prepared with AI assistance (Claude Opus 5). I checked the match arms and traced the print order in showHelp() myself before opening this.

Problem

Two things are off in the --format entry of vobject --help.

The description is split in half by another option. showHelp() prints line by line, and the continuation of the format list sits after the --forgiving line, so the actual output reads:

  --format      Convert to a specific format. Must be one of: vcard, vcard21,
  --forgiving   Makes the parser less strict.
                vcard30, vcard40, icalendar20, jcal, jcard, json, mimedir.

One accepted value is missing. The format case in parseArguments() accepts ten values:

$this->format = match ($value) {
    'jcard', 'jcal', 'vcard21', 'vcard30', 'vcard40', 'icalendar20', 'json', 'mimedir', 'icalendar', 'vcard' => $value,
    default => throw new \InvalidArgumentException('Unknown format: '.$value),
};

The help text lists nine — icalendar (without the 20 suffix) is absent, even though --format=icalendar works.

Fix

Move the continuation lines back under --format and add icalendar. The list now needs three lines to stay inside the same width as the surrounding entries, so it wraps onto mimedir. rather than being crammed in.

Resulting output:

  --format      Convert to a specific format. Must be one of: vcard, vcard21,
                vcard30, vcard40, icalendar, icalendar20, jcal, jcard, json,
                mimedir.
  --forgiving   Makes the parser less strict.

Help text only — no behaviour change.

The continuation of the --format value list was printed after the
--forgiving line, so the help output broke the description in half:

  --format      Convert to a specific format. Must be one of: vcard, vcard21,
  --forgiving   Makes the parser less strict.
                vcard30, vcard40, icalendar20, jcal, jcard, json, mimedir.

Move the continuation back under --format, and add the missing
'icalendar' value: the match in the 'format' case accepts ten values,
the help text listed nine.
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.

2 participants