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.

MyScript.class.ps1 647 B

123456789101112131415
  1. class MyScript : System.Management.Automation.IValidateSetValuesGenerator {
  2. static [string[]] _GetValidValues([string]$wordToComplete,[bool]$Strict) {
  3. $local:possibleValues = $(
  4. Get-ChildItem $global:MyPSScriptRoot -Filter '*.ps1' -Recurse |
  5. Select-Object -ExpandProperty FullName | ForEach-Object {
  6. $_ -replace '\.ps1$','' -replace "$($MyPSScriptRoot -replace '\\',"\\")[/\\]",''
  7. }
  8. )
  9. return $(Get-PossibleArguments -WordToComplete $wordToComplete -FullValueSet $possibleValues -Strict:$Strict );
  10. }
  11. [String[]] GetValidValues() {
  12. return [MyScript]::_GetValidValues('',$true)
  13. }
  14. }