Added DockerCompose completion + fixes

This commit is contained in:
lksz 2021-03-23 01:06:49 -04:00
parent b5b5702b17
commit d441492cf0
24 changed files with 207 additions and 147 deletions

View file

@ -1,36 +0,0 @@
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,[string]$Path,[bool]$Strict) {
$local:possibleValues = $(
Get-ChildItem -LiteralPath $Path -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 );
}
static [string[]] _GetValidValues([string]$wordToComplete,[bool]$Strict) {
return [DockerComposeDirs]::_GetValidValues($wordToComplete,'.',$true)
}
[String[]] GetValidValues() {
return [DockerComposeDirs]::_GetValidValues('',$true)
}
}

View file

@ -0,0 +1,6 @@
function cd-{cd -}
function cd..{cd ..}
function cd...{cd ../..}
Set-Alias '..' 'cd..'
Set-Alias '...' 'cd...'