Crates.io | wsl-dirutils |
lib.rs | wsl-dirutils |
version | 0.1.0 |
source | src |
created_at | 2023-08-25 06:48:57.094535 |
updated_at | 2023-08-25 06:48:57.094535 |
description | The cli tool that wraps directory/path-related commands in wslpath. |
homepage | https://github.com/AsPulse/wsl-dirutils |
repository | https://github.com/AsPulse/wsl-dirutils |
max_upload_size | |
id | 954403 |
size | 18,164 |
The tool that wraps directory/path-related commands in wslpath.
After installing wsl-dirutils, append the below code to your .zshrc
.
function cd() {
builtin cd "$(wsl-dirutils convert "$*")"
}
function pwd() {
wsl-dirutils pwd > /dev/null
}
wsl-dirutils convert <path>
outputs the path for Linux to stdout.
Stderr is used to output messages for the user.
$ wsl-dirutils convert "C:\Users\aspulse"
stdout:
/mnt/c/Users/aspulse
stderr:
⊘ wsl-dirutils Converting... C:\users\aspulse
⮑ /mnt/c/users/aspulse
wsl-dirutils pwd <path>
outputs the path of the current directory to stdout.
If the current directory is under Windows such as /mnt/c/...
, the wsl-dirutils outputs both styles to stderr.
$ wsl-dirutils pwd
stdout:
/mnt/c/Users/aspulse
stderr:
⊘ wsl-dirutils
⮑ /mnt/c/Users/aspulse (linux)
⮑ C:\Users\aspulse (win)
We express our gratitude to wsl-path-rust, the crate that calls wslpath.exe from Rust!
It made it really easy to implement...!
Twitter X: @_AsPulse_