format.ps1xml support + fixes
+ Get-DockerProcess modified to display volume mappings (Binds) as well as docker-compose project names. + Reload-MyScripts will look for *.format.ps1xml files in the profile.d directory and load the format data from it. + Get-DockerProcess output is typed and a TypeData.format.ps1xml file was added to the package + Added _ll alias for easy posix ls -la output. + config.files.json modified for better neovim support.
This commit is contained in:
parent
fefb5e2572
commit
84d533a210
|
@ -107,7 +107,15 @@ foreach ( $local:PackagePath in $myPackages ) {
|
||||||
". '$($_.FullName)';"
|
". '$($_.FullName)';"
|
||||||
} |
|
} |
|
||||||
Invoke-Expression
|
Invoke-Expression
|
||||||
|
|
||||||
|
Join-Path $PackagePath 'profile.d' | Where-Object { Test-Path $_ } |
|
||||||
|
Get-ChildItem -Filter '*.format.ps1xml' |
|
||||||
|
ForEach-Object {
|
||||||
|
Write-Verbose "Loading $(getScriptName $_.FullName)...";
|
||||||
|
"Update-FormatData '$($_.FullName)';"
|
||||||
|
} |
|
||||||
|
Invoke-Expression
|
||||||
|
|
||||||
$local:CommandsToAlias = (
|
$local:CommandsToAlias = (
|
||||||
@( $PackagePath ) + $(
|
@( $PackagePath ) + $(
|
||||||
[SystemName]::_GetValidValues("", $true, $true) |
|
[SystemName]::_GetValidValues("", $true, $true) |
|
||||||
|
@ -131,4 +139,4 @@ foreach ( $local:alias in $myAliases.Keys ) {
|
||||||
. SafeSetAlias $alias $myAliases[$alias] '#MyAlias'
|
. SafeSetAlias $alias $myAliases[$alias] '#MyAlias'
|
||||||
}
|
}
|
||||||
|
|
||||||
Remove-Item Function:\RemoveAlias, Function:\SafeSetAlias -ErrorAction SilentlyContinue
|
Remove-Item Function:\RemoveAlias, Function:\SafeSetAlias -ErrorAction SilentlyContinue
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
_ls -la $args
|
|
@ -1,11 +1,4 @@
|
||||||
{
|
{
|
||||||
"neovim": [
|
|
||||||
"~/.config/nvim/init.vim",
|
|
||||||
"~/.config/nvim/vim-plug/plugins.vim",
|
|
||||||
"#vim",
|
|
||||||
"#vi"
|
|
||||||
],
|
|
||||||
"vi": "~/.virc",
|
|
||||||
"omp": "~/.oh-my-posh.omp.json",
|
"omp": "~/.oh-my-posh.omp.json",
|
||||||
"profile": [
|
"profile": [
|
||||||
"~/.profile",
|
"~/.profile",
|
||||||
|
@ -54,15 +47,17 @@
|
||||||
"~/.spacemacs",
|
"~/.spacemacs",
|
||||||
"#emacs"
|
"#emacs"
|
||||||
],
|
],
|
||||||
|
"vi": "~/.virc",
|
||||||
"vim": [
|
"vim": [
|
||||||
"~/.vimrc",
|
"~/.vimrc",
|
||||||
"~/.vim/vimrc"
|
"~/.vim/vimrc"
|
||||||
],
|
],
|
||||||
"nvim": [
|
"neovim": [
|
||||||
"~/.config/nvim/init.vim",
|
"~/.config/nvim/init.vim",
|
||||||
"~/.nvimrc",
|
"~/.config/nvim/vim-plug/plugins.vim",
|
||||||
"#vim"
|
"#vim"
|
||||||
],
|
],
|
||||||
|
"nvim": "#neovim",
|
||||||
"tmux": [
|
"tmux": [
|
||||||
"~/.tmux.conf",
|
"~/.tmux.conf",
|
||||||
"~/.byobu/.tmux.conf"
|
"~/.byobu/.tmux.conf"
|
||||||
|
|
|
@ -1,12 +1,31 @@
|
||||||
#[CmdletBinding(SupportsShouldProcess)]param(
|
#[CmdletBinding(SupportsShouldProcess)]param(
|
||||||
[CmdletBinding()]param([string[]]$MatchName,[string[]]$OrderBy,[switch]$PassThru,[string[]]$MatchAny)
|
[CmdletBinding()]param([string[]]$MatchName,[string[]]$OrderBy,[switch]$PassThru,[string[]]$MatchAny)
|
||||||
|
|
||||||
$local:result = $(docker ps --format='{{ .Image }}\t{{ .Names }}\t{{ .Status }}\t{{ .Ports }}' |
|
$local:containers = [ordered]@{}
|
||||||
|
$(docker ps -q) |
|
||||||
ForEach-Object {
|
ForEach-Object {
|
||||||
$local:l = $_ -split '\t';
|
$local:tmp = docker inspect $_ | ConvertFrom-Json;
|
||||||
[PSCustomObject]([ordered]@{Image=$l[0];Name=$l[1];Status=$l[2];Ports=$l[3] -replace ', ',"`n"})
|
$local:tmpObj = [PSCustomObject]([ordered]@{
|
||||||
} ) | Sort-Object Name
|
Name=$tmp.Name.Substring(1)
|
||||||
|
Project=$tmp.Config.Labels.'com.docker.compose.project'
|
||||||
|
Service=$tmp.Config.Labels.'com.docker.compose.service'
|
||||||
|
Status=$tmp.State.Status
|
||||||
|
Image=$tmp.Config.Image
|
||||||
|
Ports=$(
|
||||||
|
$tmp.HostConfig.PortBindings |
|
||||||
|
Get-Member -type NoteProperty | Select-Object -ExpandProperty Name |
|
||||||
|
ForEach-Object {
|
||||||
|
"$($tmp.HostConfig.PortBindings."$_".HostPort)/$_"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
Binds= $tmp.HostConfig.Binds
|
||||||
|
raw = $tmp
|
||||||
|
})
|
||||||
|
$tmpObj.PSObject.TypeNames.Insert(0,"DockerContainersOutput")
|
||||||
|
$containers[$tmpObj.Name]=$tmpObj
|
||||||
|
}
|
||||||
|
|
||||||
|
$local:result = $containers.Values | Sort-Object Name
|
||||||
if( $MatchName ) {
|
if( $MatchName ) {
|
||||||
$result = $result | Where-Object Name -match $($MatchName -join '|')
|
$result = $result | Where-Object Name -match $($MatchName -join '|')
|
||||||
}
|
}
|
||||||
|
@ -19,6 +38,6 @@ if( $OrderBy ) {
|
||||||
$result = $result | Sort-Object $OrderBy
|
$result = $result | Sort-Object $OrderBy
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $PassThru ) { return $result }
|
#if( $PassThru ) { return $result }
|
||||||
$result | Format-Table -Wrap
|
$result #| Format-Table -Wrap
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
|
||||||
|
<Configuration>
|
||||||
|
<ViewDefinitions>
|
||||||
|
<View>
|
||||||
|
<Name>DockerContainersOutputTable</Name>
|
||||||
|
<ViewSelectedBy>
|
||||||
|
<TypeName>DockerContainersOutput</TypeName>
|
||||||
|
</ViewSelectedBy>
|
||||||
|
<TableControl>
|
||||||
|
<TableHeaders>
|
||||||
|
<TableColumnHeader> <Width>12</Width> <Label>Project</Label> </TableColumnHeader>
|
||||||
|
<TableColumnHeader> <Width>15</Width> <Label>Service</Label> </TableColumnHeader>
|
||||||
|
<TableColumnHeader> <Width>20</Width> <Label>Name</Label> </TableColumnHeader>
|
||||||
|
<TableColumnHeader> <Width>14</Width> <Label>Status</Label> </TableColumnHeader>
|
||||||
|
<TableColumnHeader> <Width>20</Width> <Label>Image</Label> </TableColumnHeader>
|
||||||
|
<TableColumnHeader> <Width>15</Width> <Label>HostConfig.
|
||||||
|
PortBindings</Label> </TableColumnHeader>
|
||||||
|
<TableColumnHeader> <Label>HostConfig
|
||||||
|
.Binds</Label> </TableColumnHeader>
|
||||||
|
</TableHeaders>
|
||||||
|
<TableRowEntries>
|
||||||
|
<TableRowEntry>
|
||||||
|
<Wrap/>
|
||||||
|
<TableColumnItems>
|
||||||
|
<TableColumnItem> <PropertyName>Project</PropertyName> </TableColumnItem>
|
||||||
|
<TableColumnItem> <PropertyName>Service</PropertyName> </TableColumnItem>
|
||||||
|
<TableColumnItem> <PropertyName>Name</PropertyName> </TableColumnItem>
|
||||||
|
<TableColumnItem> <PropertyName>Status</PropertyName> </TableColumnItem>
|
||||||
|
<TableColumnItem> <ScriptBlock>
|
||||||
|
$($($($_.Image -split ':') -join "`n:") -split '/') -join "`n/"
|
||||||
|
</ScriptBlock> </TableColumnItem>
|
||||||
|
<TableColumnItem> <ScriptBlock> $_.Ports -join "`n" </ScriptBlock> </TableColumnItem>
|
||||||
|
<TableColumnItem> <ScriptBlock> $_.Binds -join "`n" </ScriptBlock> </TableColumnItem>
|
||||||
|
</TableColumnItems>
|
||||||
|
</TableRowEntry>
|
||||||
|
</TableRowEntries>
|
||||||
|
</TableControl>
|
||||||
|
</View>
|
||||||
|
</ViewDefinitions>
|
||||||
|
</Configuration>
|
Loading…
Reference in New Issue