-
Notifications
You must be signed in to change notification settings - Fork 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
fix: support tilde expansion #128
base: main
Are you sure you want to change the base?
fix: support tilde expansion #128
Conversation
|| (text.find('~').unwrap_or(0) == text.len() - 1) | ||
{ | ||
let temp = text.clone().replace( | ||
'~', |
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.
Can you add this as a test case? I think it will fail: echo ~/test/~/test
(should only expand ~/
)
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.
Thanks! Let's shift this to happen when executing and not when parsing.
text.push_str(temp.as_str()); | ||
} | ||
} | ||
} |
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.
I don't think we should do this while parsing, but instead during execution. The home directory in the shell might change while running. For example, the following test case should pass:
$ export HOME=test ; echo ~/test/~/test
test/test/~/test
@dsherret |
@dsherret |
This PR suggests possible solution for #26676
Changes