-
Notifications
You must be signed in to change notification settings - Fork 0
feat: support multi-character aliases #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
boneskull
commented
Jan 7, 2026
- Register multi-char aliases as separate options with parseArgs()
- Collapse alias values into canonical names after parsing
- Detect conflicts when both alias and canonical provided for non-array options
- Merge values for array options when both alias and canonical provided
- Validate aliases don't conflict with canonical option names
- Validate aliases don't conflict with auto-generated boolean negations
- Display multi-character aliases in help output
- Update README.md documentation with aliases section
- Register multi-char aliases as separate options with parseArgs() - Collapse alias values into canonical names after parsing - Detect conflicts when both alias and canonical provided for non-array options - Merge values for array options when both alias and canonical provided - Validate aliases don't conflict with canonical option names - Validate aliases don't conflict with auto-generated boolean negations - Display multi-character aliases in help output - Update README.md documentation with aliases section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for multi-character aliases for CLI options, expanding beyond the previous single-character limitation. The implementation registers multi-character aliases as separate options in Node.js parseArgs(), then collapses them back to canonical names after parsing.
Key changes:
- Multi-character aliases are now validated and supported alongside single-character aliases
- Conflict detection ensures aliases don't collide with option names or auto-generated boolean negations
- Array options merge values from all aliases; non-array options detect conflicts when both alias and canonical are used
- Help text displays multi-character aliases sorted by length
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/validate.ts |
Added validation to check aliases against canonical names and boolean negations; removed single-character restriction |
src/parser.ts |
Implemented collapseAliases() function to merge multi-char alias values into canonical names; registers multi-char aliases as separate parseArgs options |
src/opt.ts |
Enhanced alias conflict validation to check against canonical names and boolean negations |
src/help.ts |
Updated help formatting to display multi-character aliases sorted by length alongside short aliases |
src/types.ts |
Updated documentation for the aliases property to describe both short and long alias support |
test/validate.test.ts |
Added comprehensive tests for multi-char alias validation, conflicts, and error cases |
test/parser.test.ts |
Added tests for parsing multi-char aliases, conflict detection, and array value merging |
test/opt.test.ts |
Added tests for alias conflict detection in the opt builder API |
test/help.test.ts |
Added tests to verify multi-char aliases appear correctly in help output |
README.md |
Added dedicated "Aliases" section with examples of short and long alias usage, conflict behavior, and array merging |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Fix README example to show actual array merge order (canonical/short first, multi-char aliases appended) instead of command-line order - Improve error message for alias-negation conflicts to show which boolean option generates the conflicting negation - Update test comments to clarify merge order is documented behavior 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
