mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-02 07:07:46 +00:00
commit
f02ec17220
1 changed files with 16 additions and 5 deletions
|
@ -2,10 +2,21 @@
|
||||||
def docker [
|
def docker [
|
||||||
...args:string # command to be passed to the real docker command
|
...args:string # command to be passed to the real docker command
|
||||||
] {
|
] {
|
||||||
^docker $args --format='{{json .}}'|
|
let data = (^docker $args --format={{json .}}|lines|each {$it|from json})
|
||||||
lines|
|
if Labels in ($data|get) {
|
||||||
each {
|
$data|docker labels
|
||||||
$it|
|
} {
|
||||||
from json
|
$data
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# subcommand used to reformat docker labels into their own table
|
||||||
|
def 'docker labels' [] {
|
||||||
|
update Labels {
|
||||||
|
get Labels|
|
||||||
|
split row ','|
|
||||||
|
where ($it|str starts-with ' ') == $false|
|
||||||
|
split column '=' name value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue