Closed wthueb closed 1 month ago
Homedir expansion is one of the tough topics.
There's a difference between unquoted ~
(expanded) and quoted "~"
(not exanded) tilde.
But the information of it being quoted or not gets lost along the way.
I think it's safe for now to simply assume expansion here if one passes the ~
prefix as argument.
But be aware that while it shows completions using carapace the git command will likely fail if quoted:
git --git-dir ~/.cfg --work-tree ~ log # works
git --git-dir "~/.cfg" --work-tree "~" log # fails
Current Behavior
With a bare repo at ~/.cfg with a worktree of ~ (happens to be my dotfiles repo), the following command gives an error:
Changing the command to
carapace git nushell "git" "--git-dir" "/Users/wil/.cfg" "--work-tree" "/Users/wil" "add" ""
seems to avoid that error (this solution is not ideal, as I'd rather use ~ expansion for home instead of getting weird with environment variables, especially considering the nushell completer setup doesn't seem to expand environment variables/interpolate strings?):However, it still doesn't quite work how it should. In my instance, if I
cd
to~/.config/nushell
and run the command again, it still uses paths relative to the worktree even though they should be relative to the CWD:Expected Behavior
In the above instance,
~/.config/nushell > carapace git nushell "git" "--git-dir" "~/.cfg" "--work-tree" "~" "add" ""
to outputconfig.nu
.Steps To Reproduce
With
carapace
1.0.5, runcarapace git nushell "git" "--git-dir" "~/.cfg" "--work-tree" "~" "add" ""
with the CWD being anything other than the worktree dir, in this case~
. Don't think this is isolated to nushell, seems to happen in bash as well.Version
1.0.5
OS
Shell
Anything else?
No response
Polar