Skip to content

feat: add short flag aliases via FlagMetadata.Short#11

Merged
mfridman merged 3 commits intomainfrom
feat/short-flags
Feb 16, 2026
Merged

feat: add short flag aliases via FlagMetadata.Short#11
mfridman merged 3 commits intomainfrom
feat/short-flags

Conversation

@mfridman
Copy link
Collaborator

@mfridman mfridman commented Feb 16, 2026

This PR adds support for single-character short flag aliases (e.g., -v for --verbose) driven by the existing FlagMetadata struct.

A new Short field on FlagMetadata registers the short alias in the combined flag set sharing the same Value pointer as the long flag, so all four input forms (-v, --v, -verbose, --verbose) work out of the box via Go's flag package.

The help output uses conventional formatting: -v, --verbose for flags with a short alias, and --config (padded) for flags without one when any sibling has a short alias. Flags without any short aliases in the set skip the padding entirely. The display also now uses double-dash (--) for long flag names to match CLI conventions.

Fix #1

@mfridman mfridman merged commit b6285cf into main Feb 16, 2026
3 checks passed
@mfridman mfridman deleted the feat/short-flags branch February 16, 2026 20:33
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.

feat: mapping short flags

1 participant

Comments