fix(prompt): stop dash-led directories from breaking pwd truncation - #98
Merged
Conversation
_tide_pwd's truncation branch passed directory names to string match, string escape, and string join without --. A name starting with a dash was then read as an option, breaking the prompt. Same bug as upstream IlanCosman/tide#668; here it shows as a "test: Missing argument" error instead of a hang, since prompts are handed off through a tempfile rather than a shared universal variable. Add -- before each path-derived value, and add regression tests for the plain error case and the hang case (a same-prefix sibling that forces the truncation loop to grow past the dash).
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
_tide_pwd's truncation branch passed directory names tostring match,string escape, andstring joinwithout--. A name starting with a dash was read as an option, breaking the prompt.test: Missing argumenterror rather than a hang, since this fork hands prompts off through a tempfile instead of a shared universal variable.--before each path-derived value in the truncation branch.Test plan
mise run test(full suite, including two new regression cases: a long dash-led directory, and a same-prefix sibling that forces the disambiguation loop past the dash)mise run fmt/mise run lint