Edit-MyScript fix for Windows/PS5.1
When calling Edit-TextFile wihtout explicitly specifying -Path, multiple files in command line would be passed on to editor incorrectly, with the -Path explicitly specified, this now works in all versions of PowerShell
This commit is contained in:
parent
9f0d669b4c
commit
c38785cbf5
|
@ -83,11 +83,12 @@ foreach( $local:p in $ScriptPaths ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$local:sw = [System.Diagnostics.Stopwatch]::StartNew();
|
$local:sw = [System.Diagnostics.Stopwatch]::StartNew();
|
||||||
Edit-TextFile $ScriptPaths
|
Edit-TextFile -Path $ScriptPaths
|
||||||
$sw.Stop();
|
$sw.Stop();
|
||||||
|
|
||||||
if( $sw.Elapsed.TotalSeconds -lt 1 ) {
|
if( $sw.Elapsed.TotalSeconds -lt 3 ) {
|
||||||
$null = Read-Host "Waiting before refreshing. Press <Enter> when you're done editing ( don't forget to save ;) )..."
|
Write-Host -ForegroundColor DarkGreen "When done editing, you might want to run '. Reload-MyScripts'"
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
Get-Command -ListImported Reload-MyScripts -ErrorAction SilentlyContinue |
|
Get-Command -ListImported Reload-MyScripts -ErrorAction SilentlyContinue |
|
||||||
|
|
Loading…
Reference in New Issue