mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 22:57:46 +00:00
image-push supports renaming via -t (#750)
fix nu-complete of `docker registry show` Co-authored-by: nash <nash@iffy.me>
This commit is contained in:
parent
73955cd4cf
commit
302fd84fed
1 changed files with 15 additions and 5 deletions
|
@ -257,9 +257,19 @@ export def image-tag [from: string@"nu-complete docker images" to: string -n: s
|
||||||
}
|
}
|
||||||
|
|
||||||
# push image
|
# push image
|
||||||
export def image-push [img: string@"nu-complete docker images" -n: string@"nu-complete docker ns" -i] {
|
export def image-push [
|
||||||
|
img: string@"nu-complete docker images"
|
||||||
|
--tag(-t): string
|
||||||
|
-n: string@"nu-complete docker ns" -i
|
||||||
|
] {
|
||||||
let $insecure = if $i {[--insecure-registry]} else {[]}
|
let $insecure = if $i {[--insecure-registry]} else {[]}
|
||||||
^$env.docker-cli ...($n | with-flag -n) ...$insecure push $img
|
if ($tag | is-empty) {
|
||||||
|
^$env.docker-cli ...($n | with-flag -n) ...$insecure push $img
|
||||||
|
} else {
|
||||||
|
^$env.docker-cli ...($n | with-flag -n) tag $img $tag
|
||||||
|
^$env.docker-cli ...($n | with-flag -n) ...$insecure push $tag
|
||||||
|
^$env.docker-cli ...($n | with-flag -n) rmi $tag
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# pull image
|
# pull image
|
||||||
|
@ -395,9 +405,9 @@ def has [name] {
|
||||||
def "nu-complete registry show" [cmd: string, offset: int] {
|
def "nu-complete registry show" [cmd: string, offset: int] {
|
||||||
let new = $cmd | str ends-with ' '
|
let new = $cmd | str ends-with ' '
|
||||||
let cmd = $cmd | split row ' '
|
let cmd = $cmd | split row ' '
|
||||||
let url = $cmd.2?
|
let url = $cmd.3?
|
||||||
let reg = $cmd.3?
|
let reg = $cmd.4?
|
||||||
let tag = $cmd.4?
|
let tag = $cmd.5?
|
||||||
let auth = if ($env | has 'REGISTRY_TOKEN') {
|
let auth = if ($env | has 'REGISTRY_TOKEN') {
|
||||||
[-H $"Authorization: Basic ($env.REGISTRY_TOKEN)"]
|
[-H $"Authorization: Basic ($env.REGISTRY_TOKEN)"]
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue