A lot of new stuff

Docker and Docker-Compose commands and aliases:
- dco: docker-compose
- dcc: docker-compose config
- dcedit/vidc/Edit-DockerCompose:
    edit docker-compose.yml and satellite files
- dcdown.ps1
- dl/dll/dcl/dcll:
    view docker/docker-compose logs
    l : follow
    ll : just list
- dx/dcx: docker / docker-compose exec
- dcdown: docker-compose down
- dcup: docker-compose up
- dcr: docker-compose run
- dcre: docker-compose restart
- dcreup: docker-compose up with force recreate
- di: docker inspect

A bunch of other aliases and tools:
- l/ll - shortcuts for ls -la
- Edit-MyConfig with MyConfig.class: Edit various configuration files
- Update-ArchOSz: my common update params for Arch all ready to run
- Update-UbuntuOSz: my common update params for Ubuntu all ready to run
- sz-df - a ps stylized df
- sz-du - what's the size of a dir
- sys.Linux/ls - a Linux specific ls (with all required configuration)

Works in progress (not completely tested yet):
- Stop-ProcessTree
- Update-OSz.ps1
- src/smartsudo.inc.ps1
This commit is contained in:
lksz 2020-10-31 17:10:32 -04:00
parent 306e03874d
commit 310103c2f7
29 changed files with 226 additions and 8 deletions

View file

@ -1,13 +1,54 @@
class MyConfig { #: System.Management.Automation.IValidateSetValuesGenerator {
static [hashtable]$configDirectory = [ordered]@{
'vi' = '~/.virc'
'vim' = '~/.vimrc','~/.vim/vimrc'
'neovim' = '~/.config/nvim/init.vim','~/.config/nvim/vim-plug/plugins.vim','#vim','#vi'
static [hashtable]$configDirectory = @{};
static ReloadConfigPaths() {
[MyConfig]::ConfigDirectory = [ordered]@{
'vi' = '~/.virc'
'vim' = '~/.vimrc','~/.vim/vimrc'
'neovim' = '~/.config/nvim/init.vim','~/.config/nvim/vim-plug/plugins.vim','#vim','#vi'
'zshrc' = '~/.zshrc'
'sz-zshrc' = '~/.sz.zshrc.sh', '#zshrc'
'sz-local-rc' = '~/.sz.local.sh'
'sz-aliases-sh' = '~/.sz.aliases.sh'
'sz-shrc' = '~/.sz.shrc.sh'
'sz-rc-all' = '#sz-aliases-sh', '#sz-local-rc', '#sz-shrc', '#sz-zshrc', '#zshrc'
'tmux' = '~/.tmux.conf', '~/.byobu/.tmux.conf'
}
}
static [string[]] GetConfigPaths([string[]]$ConfigNames) {
return $null
static [string[]] GetConfigPaths([string[]]$ConfigNames,[switch]$Force) {
[MyConfig]::ReloadConfigPaths()
$local:result = [string[]]@()
$local:flat = $false
while(-not $flat) {
$flat = $true
$ConfigNames += $ConfigNames | ForEach-Object {
[MyConfig]::configDirectory[$_]
} | Where-Object { $_ -match '^#[\w-\.]+$' } | ForEach-Object {
$_.Substring(1)
} | Where-Object { $_ -notin $ConfigNames } | ForEach-Object {
$flat = false; $_;
}
}
$local:flatConfigList = $ConfigNames | ForEach-Object {
[MyConfig]::configDirectory[$_]
} | Where-Object { $_ -notmatch '^#[\w-\.]+$' }
$local:exists = $false;
$local:first = $null
foreach( $local:configPath in $flatConfigList ) {
if( -not $first ) { $first = $configPath }
if( $Force -or (Test-Path $configPath) ) {
$result += Resolve-Path $configPath
$exists = $true
}
}
if( -not $exists -and -not $Force ) {
$result += $first
}
return $result
}
static [string[]] _GetValidValues([string]$wordToComplete,[bool]$Strict) {
[MyConfig]::ReloadConfigPaths()
$local:possibleValues = [MyConfig]::configDirectory.Keys
return $(Get-PossibleArguments -WordToComplete $wordToComplete -FullValueSet $possibleValues -Strict:$Strict );
}