Added DockerCompose completion + fixes
This commit is contained in:
parent
b5b5702b17
commit
d441492cf0
24 changed files with 207 additions and 147 deletions
|
@ -35,14 +35,10 @@ process {
|
|||
}
|
||||
$p = $p -replace '#C-A#','*' -replace '#C-Q#','?' -replace '#C-#','#C-'
|
||||
|
||||
if( $Expand ) {
|
||||
$p = $p | ForEach-Object {
|
||||
if( Test-Path $p ) {
|
||||
$p | Get-Item -Force | Select-Object -ExpandProperty FullName
|
||||
} elseif( -not $Expand ) {
|
||||
$p
|
||||
}
|
||||
}
|
||||
if( $p -match '\*|\?' -and $Expand ) {
|
||||
$p = $p | Where-Object { Test-Path $_ } |
|
||||
Get-Item -Force |
|
||||
Select-Object -ExpandProperty FullName
|
||||
}
|
||||
|
||||
$p
|
||||
|
|
1
base/_ls.ps1
Normal file
1
base/_ls.ps1
Normal file
|
@ -0,0 +1 @@
|
|||
env ls $args
|
1
base/ls.ps1
Normal file
1
base/ls.ps1
Normal file
|
@ -0,0 +1 @@
|
|||
Get-ChildItem -Force $args
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
6
base/profile.d/cd-shortcuts.ps1
Normal file
6
base/profile.d/cd-shortcuts.ps1
Normal file
|
@ -0,0 +1,6 @@
|
|||
function cd-{cd -}
|
||||
function cd..{cd ..}
|
||||
function cd...{cd ../..}
|
||||
|
||||
Set-Alias '..' 'cd..'
|
||||
Set-Alias '...' 'cd...'
|
Loading…
Add table
Add a link
Reference in a new issue