33 lines
1.2 KiB
PowerShell
33 lines
1.2 KiB
PowerShell
class DockerContainer { #: System.Management.Automation.IValidateSetValuesGenerator {
|
|
static [string[]] _GetValidValues([string]$wordToComplete,[bool]$Strict) {
|
|
$local:possibleValues = $(
|
|
docker ps -a --no-trunc --format "{{.Names}}"
|
|
)
|
|
return $(Get-PossibleArguments -WordToComplete $wordToComplete -FullValueSet $possibleValues -Strict:$Strict );
|
|
}
|
|
|
|
[String[]] GetValidValues() {
|
|
return [DockerContainer]::_GetValidValues('',$true)
|
|
}
|
|
}
|
|
|
|
class DockerComposeDirs { #: System.Management.Automation.IValidateSetValuesGenerator {
|
|
static [string[]] _GetValidValues([string]$wordToComplete,[bool]$Strict) {
|
|
$local:possibleValues = $(
|
|
Get-ChildItem -Directory -Depth 3 |
|
|
Where-Object { $_ |
|
|
Get-ChildItem -Include 'docker-compose.y*l' |
|
|
Where-Object Extension -in '.yml','.yaml'
|
|
} | ForEach-Object {
|
|
$_.FullName.Replace($(Join-Path $PWD ""),'')
|
|
}
|
|
)
|
|
return $(Get-PossibleArguments -WordToComplete $wordToComplete -FullValueSet $possibleValues -Strict:$Strict );
|
|
}
|
|
|
|
[String[]] GetValidValues() {
|
|
return [DockerComposeDirs]::_GetValidValues('',$true)
|
|
}
|
|
}
|
|
|