mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 22:57:46 +00:00
Check for Labels existence
Run Labels reformatting conditionally as not all docker commands return that field
This commit is contained in:
parent
c8f46f1882
commit
ff0017207f
1 changed files with 11 additions and 6 deletions
|
@ -2,12 +2,17 @@
|
|||
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 ','|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue