1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-02 07:07:46 +00:00

Merge pull request #115 from Yethal/patch-2

Update docker.nu
This commit is contained in:
Darren Schroeder 2021-12-13 06:12:18 -06:00 committed by GitHub
commit f02ec17220
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,10 +2,21 @@
def docker [
...args:string # command to be passed to the real docker command
] {
^docker $args --format='{{json .}}'|
lines|
each {
$it|
from json
let data = (^docker $args --format={{json .}}|lines|each {$it|from json})
if Labels in ($data|get) {
$data|docker labels
} {
$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
}
}