Feature Request: Get Shell Elevation Command from Environment
sgapps-de opened this issue · 0 comments
Description
It would be great to define the command executed by gsudo, when called without parameters (shell elevation) via an environment variable. This is especially useful when the shell was started with a special profile - e.g.
cmd /k profile.cmd
Proposed technical details
In the profile a special environment variable could be defined to set the correct shell elevation command - in the above case it could be
set GSUDO_CMD_ELEVATION=cmd /k profile.cmd --sudo
There can be special variables for every type of shell:
GSUDO_PWSH_ELEVATION
GSUDO_YORI_ELEVATION
GSUDO_WSL_ELEVATION
GSUDO_BASH_ELEVATION
GSUDO_BUSYBOX_ELEVATION
GSUDO_TAKE_ELEVATION
GSUDO_NUSHELL_ELEVATION
GSUDO_CMD_ELEVATION
And also a "catch all" variable:
GSUDO_ELEVATION
Optionally it would also be possible to have configuration settings - but I think environment variables are preferable and should have priority. For example in a "profile2.cmd" there would be
set GSUDO_CMD_ELEVATION=cmd /k profile2.cmd --sudo
I have implemented the environment version (except for wsl elevation) and could make a pull request if desired. In my implementation a "*" at the beginning of the command is replaced by the full path to the shell executable. So one could also use
set GSUDO_CMD_ELEVATION=* /k profile.cmd --sudo
or
set GSUDO_CMD_ELEVATION=* /k "%~f0" --sudo