hangxingliu / wslgit

:candy: Use Git installed in WSL(Windows Subsystem for Linux) from Windows and Visual Studio Code
GNU General Public License v3.0
150 stars 18 forks source link

get rid of gawk dependency #1

Closed unlimitedsola closed 6 years ago

unlimitedsola commented 6 years ago

wslpath is a new tool you can use to convert paths between Windows and Linux. Run wslpath in a WSL environment.

The options are:

-a force result to absolute path format
-u translate from a Windows path to a WSL path (default)
-w translate from a WSL path to a Windows path
-m translate from a WSL path to a Windows path, with ‘/’ instead of ‘\\’
unlimitedsola commented 6 years ago

Example:

➜  ~ wslpath "C:\Users\loli"
/mnt/c/Users/loli
➜  ~ wslpath "C:\Windows\System32"
/mnt/c/Windows/System32
➜  ~
hangxingliu commented 6 years ago

but wslpath throw an exception when the parameter is not a path, for example:

git clone git@github.com:hangxingliu/wslgit.git "C:\Projects\wslgit"

and it hard to replace linux path to windows path in stdout of git

hangxingliu commented 6 years ago

Similar issue: https://github.com/andy-5/wslgit/issues/12

unlimitedsola commented 6 years ago

wslpath will give non-zero return code if it failed to transform the input path, maybe we can leverage on this to test against each argument.