mirror of
https://github.com/gerardog/gsudo.git
synced 2025-01-07 03:06:40 +08:00
Updated docs to suggest Import-Module gsudoModule
instead of the absolute path.
This commit is contained in:
parent
fc2345f768
commit
5dbf0b6a96
@ -211,10 +211,10 @@ Alternative syntaxes:
|
||||
|
||||
``` Powershell
|
||||
# Add the following line to your $PROFILE
|
||||
Import-Module "$env:ProgramFiles\gsudo\Current\gsudoModule.psd1"
|
||||
Import-Module "gsudoModule"
|
||||
|
||||
# Or run:
|
||||
Get-Command gsudoModule.psd1 | % { Write-Output "`nImport-Module `"$($_.Source)`"" | Add-Content $PROFILE }
|
||||
Write-Output "`nImport-Module `"gsudoModule`"" | Add-Content $PROFILE
|
||||
```
|
||||
|
||||
- If you haven't already customized your PowerShell prompt (for example by installing Oh-My-Posh), you can easily add a red `#` indicating that the current process is elevated:
|
||||
|
@ -164,10 +164,10 @@ gsudo -d dir C:\
|
||||
Add the following line to your $PROFILE (replace with full path)
|
||||
|
||||
``` powershell
|
||||
Import-Module 'C:\FullPathTo\gsudoModule.psd1'
|
||||
Import-Module 'gsudoModule.psd1'
|
||||
|
||||
# Or let the following line do it for you run:
|
||||
Get-Command gsudoModule.psd1 | % { Write-Output "`nImport-Module `"$($_.Source)`"" | Add-Content $PROFILE }
|
||||
Write-Output "`nImport-Module `"gsudoModule`"" | Add-Content $PROFILE
|
||||
```
|
||||
|
||||
:::tip
|
||||
|
@ -39,13 +39,14 @@ if ($process.ExitCode -ne 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
New-Item -Type Directory ($PROFILE | Split-Path) -ErrorAction SilentlyContinue
|
||||
|
||||
Write-Output "gsudo installed succesfully!"
|
||||
Write-Output "Please restart your consoles to use gsudo!`n"
|
||||
|
||||
"PowerShell users: To use enhanced gsudo and Invoke-Gsudo cmdlet, add the following line to your `$PROFILE"
|
||||
" Import-Module 'gsudoModule'"
|
||||
"Or run: "
|
||||
" New-Item -Type Directory (`$PROFILE | Split-Path) -ErrorAction Ignore"
|
||||
" Write-Output `"``nImport-Module 'gsudoModule'`" | Add-Content `$PROFILE"
|
||||
|
||||
Remove-Item $fileName
|
||||
|
@ -16,8 +16,7 @@ namespace gsudo.Commands
|
||||
{
|
||||
if (ShellHelper.InvokingShell.In (Shell.PowerShell, Shell.PowerShellCore, Shell.PowerShellCore623BuggedGlobalInstall))
|
||||
{
|
||||
var module = Path.Combine(Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName), "gsudoModule.psd1");
|
||||
throw new ApplicationException($"To use `gsudo !!` from powershell, run or add the following line to your `$PROFILE:\n\n Import-Module '{ module }'");
|
||||
throw new ApplicationException($"To use `gsudo !!` from PowerShell, run or add the following line to your PowerShell $PROFILE:\n\n Import-Module 'gsudoModule'");
|
||||
}
|
||||
|
||||
var caller = Process.GetCurrentProcess().GetShellProcess().MainModule.ModuleName;
|
||||
|
Loading…
Reference in New Issue
Block a user