Setup-Profile and co.
Setup-Profile included, read all about it at https://blog.lksz.me/the-profile-and-setting-it-up When running Edit-MyScript without parameters, the $MyPSScriptRoot path will be sent (editing the directory) Added ability to edit scripts with Edit-MyPrfiles, making editing profiles alongside scripts easy.
This commit is contained in:
parent
06052cfa29
commit
ae07e06c27
6 changed files with 352 additions and 43 deletions
|
@ -1,6 +1,23 @@
|
|||
[CmdletBinding(SupportsShouldProcess)]param(
|
||||
[switch]$sudo,
|
||||
[switch]$Force
|
||||
[switch]$Force,
|
||||
[Parameter(ValueFromRemainingArguments = $true)]
|
||||
[ArgumentCompleter({ param (
|
||||
$commandName,
|
||||
$parameterName,
|
||||
$wordToComplete,
|
||||
$commandAst,
|
||||
$fakeBoundParameters
|
||||
)
|
||||
[MyScript]::_GetValidValues($wordToComplete,$false)
|
||||
})]
|
||||
[string[]]$AlsoEditTheseScripts
|
||||
)
|
||||
|
||||
Edit-TextFile -sudo:$sudo $( Get-Profiles | Where-Object { $_.Exists -or $Force } | Select-Object -ExpandProperty Path )
|
||||
$local:FilePaths = @() + $( Get-Profiles | Where-Object { $_.Exists -or $Force } | Select-Object -ExpandProperty Path )
|
||||
foreach( $local:p in $AlsoEditTheseScripts ) {
|
||||
$local:sp = Join-Path $MyPSScriptRoot "$p`.ps1"
|
||||
$FilePaths += $sp
|
||||
}
|
||||
|
||||
Edit-TextFile -sudo:$sudo $FilePaths
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue