Issue: `gsudo !!` works in PowerShell but `sudo !!` doesn't
MigProPlayer opened this issue · 2 comments
Issue Description
After adding Import-Module 'gsudoModule'
to my Powershell 7 profile, executing the last command with gusdo !!
works. But trying to do the same thing but with the sudo
alias (sudo !!
) throws out an error about the module not being imported.
The sudo
alias works for everything else except doing sudo !!
.
Steps to Reproduce
- Add
Import-Module 'gsudoModule'
to your powershell profile - Reload your console
- Execute a command that needs admin
- Use
sudo !!
to rerun that command as admin - See it error out
Screenshots
Context:
- Windows version: Win11 Pro 23H2 - English
- gsudo version: 2.5.0
- PowerShell version: 7.4.2
Hi,
The behaviour is intentional: to not mess with other sudo tools, if exists. The problem is the documentation is poor and needs to document this.
Please add this to your profile, after Import-Module gsudoModule
:
Set-Alias sudo gsudo
That will fix the issue.
And btw, since you have gsudoModule, instead of !!, you may want to write gsudo
+ space + tab key
> Do-Something
Insuficient Access
> gsudo [press tab key] --> will autocomplete with:
> gsudo { Do-Something }
I think that one featyre is much better than !!
Oh, I didn't know it was an intended feature.
Thank you for letting me know!
I'll make sure to check the autocompletion later on.