dotfiles/nushell/config/docker.nu

44 lines
1.1 KiB
Plaintext
Raw Normal View History

2023-11-13 10:59:32 +01:00
# docker aliases
alias ld = lazydocker
alias dc = docker-compose
alias dcb = docker-compose build
def dcp [] { docker-compose build; docker-compose push }
alias dcu = docker-compose up -d --build --remove-orphans
alias dcd = docker-compose down
def dcr [] { docker-compose down; docker-compose up -d --build --remove-orphans }
# kubernetes aliases
$env.KUBECONFIG = if ([$env.HOME, .kubes, current-cube] | path join | path exists) {
open ([$env.HOME, .kubes, current-cube] | path join)
} else {
""
}
def _kube_kubes [] {
_ls ~/.kubes | where type == dir | get name | path basename
}
def-env kube [name?: string@_kube_kubes] {
use assert
let kubes_path = [$env.HOME, .kubes] | path join
if $name == null {
rm ([$kubes_path, current-cube] | path join)
$env.KUBECONFIG = ""
return
}
let kube_config = [$kubes_path, $name, config] | path join
if not ($kube_config | path exists) {
error make {msg: ($kube_config + " does not exist")}
}
$kube_config | save -f ([$kubes_path, current-cube] | path join)
$env.KUBECONFIG = $kube_config
}
alias kns = k9s