45 lines
1.4 KiB
PowerShell
45 lines
1.4 KiB
PowerShell
|
[CmdletBinding()]param(
|
||
|
[Parameter(ParameterSetName="Normal")]
|
||
|
[Parameter(ParameterSetName="DropNamespace")]
|
||
|
[string]$Filter,
|
||
|
[Parameter(ParameterSetName="ByPackage",Mandatory)]
|
||
|
[Parameter(ParameterSetName="DropNamespace",Mandatory)]
|
||
|
[ArgumentCompleter({ param (
|
||
|
$commandName,
|
||
|
$parameterName,
|
||
|
$wordToComplete,
|
||
|
$commandAst,
|
||
|
$fakeBoundParameters
|
||
|
)
|
||
|
$local:NotAll = $true
|
||
|
if( $fakeBoundParameters.ContainsKey("Force") ) { $NotAll = -not $fakeBoundParameters.Force }
|
||
|
[Packagesz]::_GetValidValues($wordToComplete,$NotAll,$true)
|
||
|
})]
|
||
|
[string]$Package,
|
||
|
[Parameter(ParameterSetName="Normal")]
|
||
|
[Parameter(ParameterSetName="ByPackage")]
|
||
|
[Parameter(ParameterSetName="DropNamespace",Mandatory)]
|
||
|
[switch]$NamesOnly,
|
||
|
[Parameter(ParameterSetName="Normal")]
|
||
|
[Parameter(ParameterSetName="ByPackage")]
|
||
|
[Parameter(ParameterSetName="DropNamespace")]
|
||
|
[switch]$Force,
|
||
|
[Parameter(ParameterSetName="DropNamespace",Mandatory)]
|
||
|
[switch]$DropNamespace
|
||
|
)
|
||
|
$local:rVal = [MyScript]::_GetValidValues($Filter,-not $Force,$true)
|
||
|
|
||
|
if( $Package ) {
|
||
|
$Package = Join-Path $Package ''
|
||
|
$rVal = $rVal |
|
||
|
Where-Object { $_ -match "^$Package" }
|
||
|
if( $DropNamespace ) {
|
||
|
$rVal = $rVal |
|
||
|
ForEach-Object { $_.Replace($Package,'') }
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if( $NamesOnly ) { return $rVal }
|
||
|
return $rVal | ForEach-Object { Join-Path $MyPSScriptRoot "$_`.ps1" }
|
||
|
|