Skip to content

Commit

Permalink
split up dc package
Browse files Browse the repository at this point in the history
  • Loading branch information
trusz committed Oct 28, 2019
1 parent 884fe2e commit a0ee7e6
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
16 changes: 0 additions & 16 deletions src/dc/dc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}}\""
Expand Down
14 changes: 14 additions & 0 deletions src/dc/restart.go
Original file line number Diff line number Diff line change
@@ -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()
}
16 changes: 16 additions & 0 deletions src/dc/start.go
Original file line number Diff line number Diff line change
@@ -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()
}

0 comments on commit a0ee7e6

Please sign in to comment.