fix(cli): replace all hyphens in shell completion command names#6213
Open
lihan3238 wants to merge 1 commit intoEffect-TS:mainfrom
Open
fix(cli): replace all hyphens in shell completion command names#6213lihan3238 wants to merge 1 commit intoEffect-TS:mainfrom
lihan3238 wants to merge 1 commit intoEffect-TS:mainfrom
Conversation
The shell completion generators for bash and zsh used
`command.replace("-", "__")` which only replaces the first hyphen
in command names. For commands with multiple hyphens like
`type-check-v2`, this produced `type__check-v2` instead of the
correct `type__check__v2`.
Partially addresses Effect-TS#6114
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
command.replace("-", "__")to usecommand.replaceAll("-", "__")in both bash and zsh completion generatorstype-check-v2) to produce incorrect sanitized names liketype__check-v2instead oftype__check__v2Background
The shell completion generators sanitize command names by replacing hyphens with double underscores (since hyphens are not allowed in bash/zsh function identifiers). However,
String.prototype.replace()with a string argument only replaces the first occurrence, so commands with more than one hyphen were only partially sanitized.Partially addresses #6114
Test plan