Script directory for a PowerShell profile. https://blog.lksz.me/keeping-track-of-everything/#-mypsscriptroot
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
655 B

  1. [CmdletBinding(SupportsShouldProcess)]param(
  2. [switch]$sudo,
  3. [switch]$Force,
  4. [Parameter(ValueFromRemainingArguments = $true)]
  5. [ArgumentCompleter({ param (
  6. $commandName,
  7. $parameterName,
  8. $wordToComplete,
  9. $commandAst,
  10. $fakeBoundParameters
  11. )
  12. [MyScript]::_GetValidValues($wordToComplete,$false)
  13. })]
  14. [string[]]$AlsoEditTheseScripts
  15. )
  16. $local:FilePaths = @() + $( Get-Profiles | Where-Object { $_.Exists -or $Force } | Select-Object -ExpandProperty Path )
  17. foreach( $local:p in $AlsoEditTheseScripts ) {
  18. $local:sp = Join-Path $MyPSScriptRoot "$p`.ps1"
  19. $FilePaths += $sp
  20. }
  21. Edit-TextFile -sudo:$sudo $FilePaths