Skip to content

Commit

Permalink
fix container-create (nushell#759)
Browse files Browse the repository at this point in the history
Co-authored-by: nash <[email protected]>
  • Loading branch information
fj0r and nashvi committed Feb 17, 2024
1 parent 36dcb7c commit 7025edf
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions modules/docker/docker.nu
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@ def --wrapped with-flag [...flag] {
if ($in | is-empty) { [] } else { [...$flag $in] }
}

def local_image [name] {
let s = $name | split row '/'
if ($s | length) > 1 {
$name
} else {
['localhost', $name] | str join '/'
}

}

def "nu-complete docker ns" [] {
if $env.docker-cli == 'nerdctl' {
^$env.docker-cli namespace list
Expand Down Expand Up @@ -267,7 +257,9 @@ export def image-push [
^$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
do -i {
^$env.docker-cli ...($n | with-flag -n) ...$insecure push $tag
}
^$env.docker-cli ...($n | with-flag -n) rmi $tag
}
}
Expand Down Expand Up @@ -393,7 +385,6 @@ export def container-create [
if $dry_run {
echo ([docker $ns run --name $name $args $img $cmd] | flatten | str join ' ')
} else {
let $img = if $env.docker-cli == 'nerdctl' { local_image $img } else { $img }
^$env.docker-cli ...$ns run --name $name ...$args $img ...($cmd | flatten)
}
}
Expand Down

0 comments on commit 7025edf

Please sign in to comment.