Open Nemo157 opened 12 months ago
sound reasonable!
/kind feature /good-first-issue /help
@zwpaper: This request has been marked as suitable for new contributors.
Please ensure the request meets the requirements listed here.
If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-good-first-issue
command.
Although I agree lsd ~
should work in powershell, I think it is a shell feature and should be tackled in the powershell repo
It looks like there are two funny behaviours in pwsh (7.3.7, on windows):
Get-ChildItem ~
)<tab>
will expand tilde, if there is a completionNotably, tilde expansion works correctly on mac with pwsh 7.3.7 (case 1 here).
Related:
PSNativePSPathResolution
feature, but it apparently had some edge cases and was later removed)Other programs that don't do tilde expansion for pwsh:
cargo build --manifest-path ~\git\lsd\Cargo.toml
dotnet build ~/example/example.sln
eza ~
Tilde is not expanded for native programs (only some cmdlets, e.g.
Get-ChildItem ~
)
AFAIK tilde is not expanded for anything, Get-ChildItem
receives a path with a tilde in it and internally expands it, the same as any other application that supports tilde paths on windows. (Which is why both gci ~
and gci '~'
work the same, there's no shell expansion for the quotes to suppress).
then we may need more information to decide whether this should be implemented
Maybe a vote?
Which is why both gci ~ and gci '~' work the same, there's no shell expansion for the quotes to suppress
Oh yeah you're right, the cmdlets replace the tilde regardless of quotes, so it isn't really an expansion 👍
Other cmdlets like Get-Content
also have this "tilde replacement" behaviour.
I opened a PR with powershell: https://github.com/PowerShell/PowerShell/pull/20402
We could consider using the same logic as starship here, which uses dirs-next: https://github.com/starship/starship/blob/7e82cb494c540c7a88cf126ec80aeb0f7ce611bc/src/context.rs#L212C1-L218C6
Do you know any programs that implement tilde replacement? It seems uncommon, a few more examples that don't have it:
fd . ~/
bat ~/file
I'm preparing a PR for this support. Worth noting that this expansion is supported when looking for theme files
lsd --version
:lsd 1.0.0
echo $TERM
: PowerShell 7echo $LS_COLORS
: -Expected behavior
The same as
ls $env:HOME
Actual behavior
Notes
It appears that
lsd
supports globs itself on windows, I would expect it to do the same for other common shell shorthands like~
that powershell doesn't expand itself.