microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.18k stars 806 forks source link

Add default version info flag/parameter for wsl command #5985

Open dominik-ba opened 3 years ago

dominik-ba commented 3 years ago

Background: Currently you can configure the default wsl version with the wsl command. But unless you know by heart what you did on your machine there is no possibility to know what version currently is the default.

Feature request: I would like to have a flag/parameter I can provide to the wsl command that prints out the default version.

This is especially very helpful if you use automation, dotfiles, puppet, you-name-it to configure your workstation automatically.

Ps: I wasn't able to see if this was already requested because searching for version and flag or parameter just aren't the best search keywords 😅.

therealkenc commented 3 years ago

wsl.exe --status as of some recent Insider build.

image

dominik-ba commented 3 years ago

wsl.exe --status as of some recent Insider build.

image

this needs some extended parsing but better than nothing :)

therealkenc commented 3 years ago

this needs some extended parsing but better than nothing :)

Yeah. That state of affairs needs to be broached at some point. The wsl.exe output is (in general) internationalized and presumably subject to change, which means scraping the output is not tenable as an API. But it is better than nothing.

The --status command is also pretty slow, since it is doing a lot more than fetching the default version. If you feel motivated, add a rider over in #5098 for --set-default-version with no parameters to output the current version.