Skip to content

Commit

Permalink
Add note when container runs in ad-hoc mode
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsauter committed Apr 4, 2018
1 parent c82d025 commit 4b831e0
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions crane/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,11 @@ func (c *container) Create(cmds []string) {
if !adHoc {
c.Rm(true, false)
}
fmt.Fprintf(c.CommandsOut(), "Creating container %s ...\n", c.ActualName(adHoc))
msg := "Creating container %s"
if adHoc {
msg = msg + " (ad-hoc)"
}
fmt.Fprintf(c.CommandsOut(), msg + " ...\n", c.ActualName(adHoc))

args := append([]string{"create"}, c.createArgs(cmds)...)
executeCommand("docker", args, c.CommandsOut(), c.CommandsErr())
Expand All @@ -941,12 +945,14 @@ func (c *container) Create(cmds []string) {
// have a very short-lived container.
func (c *container) Run(cmds []string, targeted bool, detachFlag bool) {
adHoc := (len(cmds) > 0)

if !adHoc {
c.Rm(true, false)
}

fmt.Fprintf(c.CommandsOut(), "Running container %s ...\n", c.ActualName(adHoc))
msg := "Running container %s"
if adHoc {
msg = msg + " (ad-hoc)"
}
fmt.Fprintf(c.CommandsOut(), msg + " ...\n", c.ActualName(adHoc))

args := append([]string{"create"}, c.createArgs(cmds)...)
// Hide output of container ID, the name of the container
Expand Down

0 comments on commit 4b831e0

Please sign in to comment.