diff --git a/Edit-DockerCompose.ps1 b/Edit-DockerCompose.ps1 index 9d491f4..8190795 100644 --- a/Edit-DockerCompose.ps1 +++ b/Edit-DockerCompose.ps1 @@ -1,4 +1,9 @@ -[CmdletBinding(SupportsShouldProcess)]param([string[]]$ProjectPath=@($PWD),[switch]$Force) +[CmdletBinding(SupportsShouldProcess)]param( + [string[]]$ProjectPath=@($PWD), + [switch]$Force, + [string[]]$AdditionalFiles + +) $local:editCandidates = @('docker-compose.yml','.base.docker-compose.yml') $local:editFiles = @() @@ -9,6 +14,6 @@ foreach( $local:fileName in $EditCandidates ) { } } -Edit-TextFile $editFiles +Edit-TextFile ($editFiles + $AdditionalFiles) $editFiles | Select-Object -First 1 | ForEach-Object { docker-compose --file $(Resolve-Path $_) config -q } diff --git a/Setup-Profile.ps1 b/Setup-Profile.ps1 index b4276dc..74b0c73 100644 --- a/Setup-Profile.ps1 +++ b/Setup-Profile.ps1 @@ -371,9 +371,23 @@ param( $local:src = "" foreach ( $local:func in $FunctionName ) { + $local:funcDef = $null + foreach( $cmd in (Get-Command -All $func) ) { + if( $cmd.CommandType -in @('Function','Filter') ) { + $funcDef = $cmd.Definition + break + } elseif( -$funcDef -and ($cmd.CommandType -in @('Script','ExternalScript')) ) { + $funcDef = Get-Content $cmd.Definition + } + } + if( -not $funcDef ) { + default { throw "Don't know how to handle $func" } + } + if ( -not $NoHeader ) { $src += "`nfunction $func {" } $src += "`n" - $src += $((Get-Command -Type Function $func).Definition) + + $src += $funcDef if ( -not $NoHeader ) { $src += "`n}" } $src += "`n" } diff --git a/dcc.ps1 b/dcc.ps1 index 6154b3a..e28210f 100644 --- a/dcc.ps1 +++ b/dcc.ps1 @@ -1,3 +1,5 @@ -[CmdletBinding(SupportsShouldProcess)]param([string[]]$ProjectPath=@($PWD)) +[CmdletBinding(SupportsShouldProcess)]param( + [string[]]$ProjectPath=@($PWD) +) $ProjectPath | ForEach-Object { docker-compose --file $(Resolve-Path $(Join-Path $_ docker-compose.yml)) config | less } diff --git a/dcdown.ps1 b/dcdown.ps1 index a7cd9c5..666fc2b 100644 --- a/dcdown.ps1 +++ b/dcdown.ps1 @@ -1 +1,9 @@ -docker-compose down --timeout=3 --volumes --remove-orphans "$args" +[CmdletBinding(SupportsShouldProcess)]param( + [string[]]$ProjectPath=@($PWD), + [Parameter(Position = 0, ValueFromRemainingArguments = $true)] + [string[]]$CliParams +) + +$ProjectPath | ForEach-Object { + docker-compose --file $(Resolve-Path $(Join-Path $_ docker-compose.yml)) down --timeout=3 --volumes --remove-orphans "$CliParams" +} diff --git a/dcup.ps1 b/dcup.ps1 index 5ab64b0..8600f47 100644 --- a/dcup.ps1 +++ b/dcup.ps1 @@ -1,10 +1,19 @@ -#[CmdletBinding(SupportsShouldProcess)]param() +[CmdletBinding(SupportsShouldProcess)]param( + [string[]]$ProjectPath=@($PWD), + [Parameter(Position = 0, ValueFromRemainingArguments = $true)] + [string[]]$CliParams +) $local:dcParams = [string]::Empty -if( $args ) { - $dcParams = $args | ForEach-Object { +if( $CliParams ) { + $dcParams = $CliParams | ForEach-Object { if( $_ -match "(?:^'[^']+'$)|(?:^`"[^`"]+`"$)|(?:^[^\s]+$)" ) { $_ } else { "'$($_.Replace( "'", "''" ))'" } } } -docker-compose up -d --remove-orphans $dcParams && docker-compose logs --follow --tail 10 $dcParams +$ProjectPath | ForEach-Object { + $local:dcPath = $(Resolve-Path $(Join-Path $_ docker-compose.yml)) + Write-Verbose "docker-compose --file $dcPath up -d --remove-orphans $dcParams && docker-compose --file $dcPath logs --follow --tail 10 $dcParams" + docker-compose --file $dcPath up -d --remove-orphans $dcParams && docker-compose --file $dcPath logs --follow --tail 10 $dcParams +} + diff --git a/src/config.files.json b/src/config.files.json index a11b946..c5bb83b 100644 --- a/src/config.files.json +++ b/src/config.files.json @@ -37,6 +37,8 @@ "ssh-pub": "~/.ssh/id_*.pub", "ssh-id": ["~/.ssh/id_ed25519","~/.ssh/id_rsa"], "ssh-auth": "~/.ssh/authorized_keys", - "ssh-conf": "/etc/ssh/sshd_config", - "ssh" : [ "#ssh-auth", "#ssh-conf", "#ssh-pub", "#ssh-id" ] + "ssh-known": "~/.ssh/known_hosts", + "ssh-conf": "~/.ssh/config", + "sshd-conf": "/etc/ssh/sshd_config", + "ssh" : [ "#ssh-auth", "#ssh-known", "#ssh-conf", "#sshd-conf", "#ssh-pub", "#ssh-id" ] }