Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Get Shell Elevation Command from Environment #372

Open
sgapps-de opened this issue Aug 24, 2024 · 0 comments
Open

Feature Request: Get Shell Elevation Command from Environment #372

sgapps-de opened this issue Aug 24, 2024 · 0 comments

Comments

@sgapps-de
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant