fix(snippet): keep create usage on a single line

What does this MR do and why?

glab snippet create declared a two-line Use string to show its stdin form. Help renders Use as one usage line, so glab snippet --help wrapped the create row onto two lines and misaligned the listing. This makes Use a single line; the stdin form is already covered by Long and the echo ... | glab snippet new example.

Adds TestUseIsSingleLine, which walks the command tree (same pattern as TestNoArgsCommandsDisableFileCompletion) so a multi-line Use can't come back.

Related to #8404.

Details

Found while testing charmbracelet/fang#103 (the fang fix for #8404) against glab. With fang v2.0.1 the row wraps:

create  -t <title> <file1>                                        [<file2>...] [--flags]  Create a new snippet.
glab snippet create  -t <title> -f <filename>  # reads from stdin

With fang#103, the two lines are flattened into one ~110-character key, which pushes every FLAGS description in glab snippet --help out to the same column. Either way, the fix belongs in the Use string.

snippet create is the only command with a multi-line Use: the new test failed on it alone before the fix.

Verification: go test ./internal/commands/ ./internal/commands/snippet/..., make gen-docs (updates docs/source/snippet/create.md), lefthook pre-commit and pre-push.

Merge request reports

Loading
Loading