Skip to content
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 nu quitcd: switched quotes #1737

Merged
merged 4 commits into from
Sep 30, 2023
Merged

fix nu quitcd: switched quotes #1737

merged 4 commits into from
Sep 30, 2023

Conversation

J-Kappes
Copy link
Contributor

@J-Kappes J-Kappes commented Sep 26, 2023

@N-R-K
Copy link
Collaborator

N-R-K commented Sep 26, 2023

Are you sure this will work on path which contain ' ?

To test quickly, do mkdir "dir'test" and then try to quitcd into that folder.

@J-Kappes
Copy link
Contributor Author

It doesn't work and I haven't found a fix yet.

@N-R-K
Copy link
Collaborator

N-R-K commented Sep 27, 2023

It doesn't work and I haven't found a fix yet.

If you can't figure out a way to fix it then leave a FIXME comment explaining the edge case.

@J-Kappes
Copy link
Contributor Author

This is pretty hacky, so leaving the FIXME might be preferable.

Copy link
Collaborator

@N-R-K N-R-K left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small reword.

misc/quitcd/quitcd.nu Outdated Show resolved Hide resolved
For a directory called
foo'bar
the NNN_TMPFILE will contain
cd 'foo'\''bar'
Handles all dir names, even including single-quotes
@@ -7,7 +7,8 @@ def-env n [...x] {
^nnn ($x | str join)
let newpath = (
if ($env.NNN_TMPFILE | path exists) {
let newpath = (open $env.NNN_TMPFILE | parse 'cd "{nnnpath}"').0.nnnpath
let rawpath = (open $env.NNN_TMPFILE | parse --regex 'cd (?P<dir>.+)').0.dir
let newpath = ($rawpath | $"echo ($in)" | /bin/bash -s)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding bash dependency on another shell's config doesn't seem like a good idea.

@N-R-K N-R-K merged commit afe8486 into jarun:master Sep 30, 2023
6 checks passed
@N-R-K
Copy link
Collaborator

N-R-K commented Sep 30, 2023

Feel free to open another PR if you manage to fix it without requiring bash or other non-posix dependency.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nushell cd on quit broken
2 participants