From a0ee7e6203bc23d439d0e3b34850e831aacb649e Mon Sep 17 00:00:00 2001 From: trusz Date: Mon, 28 Oct 2019 16:48:57 +0100 Subject: [PATCH] split up dc package --- src/dc/dc.go | 16 ---------------- src/dc/restart.go | 14 ++++++++++++++ src/dc/start.go | 16 ++++++++++++++++ 3 files changed, 30 insertions(+), 16 deletions(-) create mode 100644 src/dc/restart.go create mode 100644 src/dc/start.go diff --git a/src/dc/dc.go b/src/dc/dc.go index a36ac73..8a06e52 100644 --- a/src/dc/dc.go +++ b/src/dc/dc.go @@ -9,22 +9,6 @@ import ( "github.com/trusz/rapid-compose/src/cmd" ) -// Start _ -func Start(services []string) { - command := "docker-compose up " + strings.Join(services[:], " ") - upCommand := cmd.Run(command) - <-waitForInterrupt() - upCommand.Wait() - dcDown() -} - -// Restart _ -func Restart(containerIDs []string) { - command := "docker restart " + strings.Join(containerIDs[:], " ") - restartCommand := cmd.Run(command) - restartCommand.Wait() -} - // FindRunningContainers _ func FindRunningContainers() RunningContainers { command := "docker ps --format \"{{.ID}}\t{{.Image}}\"" diff --git a/src/dc/restart.go b/src/dc/restart.go new file mode 100644 index 0000000..0161412 --- /dev/null +++ b/src/dc/restart.go @@ -0,0 +1,14 @@ +package dc + +import ( + "strings" + + "github.com/trusz/rapid-compose/src/cmd" +) + +// Restart _ +func Restart(containerIDs []string) { + command := "docker restart " + strings.Join(containerIDs[:], " ") + restartCommand := cmd.Run(command) + restartCommand.Wait() +} diff --git a/src/dc/start.go b/src/dc/start.go new file mode 100644 index 0000000..6df7111 --- /dev/null +++ b/src/dc/start.go @@ -0,0 +1,16 @@ +package dc + +import ( + "strings" + + "github.com/trusz/rapid-compose/src/cmd" +) + +// Start _ +func Start(services []string) { + command := "docker-compose up " + strings.Join(services[:], " ") + upCommand := cmd.Run(command) + <-waitForInterrupt() + upCommand.Wait() + dcDown() +}