check docker-compose version

This commit is contained in:
Aleksander Cynarski 2021-10-23 22:16:42 +02:00
parent b172d8f43d
commit 8a91f699b8
Signed by: paramah
GPG Key ID: C4340BA42B9C173A
4 changed files with 7 additions and 2 deletions

View File

@ -16,7 +16,7 @@ var CmdComposeLogs = cli.Command{
func RunComposeLogs(cmd *cli.Context) error { func RunComposeLogs(cmd *cli.Context) error {
ctx := context.InitCommand(cmd) ctx := context.InitCommand(cmd)
compose.ExecComposerLogs(ctx) compose.ExecComposerLogs(ctx, cmd.Args())
return nil return nil
} }

View File

@ -17,6 +17,7 @@ var CmdDockerUp = cli.Command{
func RunComposeUp(cmd *cli.Context) error { func RunComposeUp(cmd *cli.Context) error {
ctx := context.InitCommand(cmd) ctx := context.InitCommand(cmd)
compose.ExecComposerUp(ctx) compose.ExecComposerUp(ctx)
compose.ExecComposerLogs(ctx, cmd.Args())
return nil return nil
} }

View File

@ -18,6 +18,7 @@ import (
const DockerComposeVersion = ">= 1.28.6" const DockerComposeVersion = ">= 1.28.6"
func CheckDockerComposeVersion() { func CheckDockerComposeVersion() {
// cmd := exec.Command("docker-compose", "--version")
cmd := exec.Command("docker-compose", "--version") cmd := exec.Command("docker-compose", "--version")
var output bytes.Buffer var output bytes.Buffer
cmd.Stdout = &output cmd.Stdout = &output
@ -124,9 +125,10 @@ func ExecComposerRestart(ctx *context.LedoContext) {
ctx.ExecCmd("docker-compose", args[0:]) ctx.ExecCmd("docker-compose", args[0:])
} }
func ExecComposerLogs(ctx *context.LedoContext) { func ExecComposerLogs(ctx *context.LedoContext, command cli.Args) {
args := ctx.ComposeArgs args := ctx.ComposeArgs
args = append(args, "logs", "--follow", "--tail", "100") args = append(args, "logs", "--follow", "--tail", "100")
args = append(args, command.Slice()...)
ctx.ExecCmd("docker-compose", args[0:]) ctx.ExecCmd("docker-compose", args[0:])
} }

View File

@ -4,6 +4,7 @@ import (
"fmt" "fmt"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"ledo/app/cmd" "ledo/app/cmd"
"ledo/app/modules/compose"
"os" "os"
) )
@ -13,6 +14,7 @@ var (
func main() { func main() {
app := cli.NewApp() app := cli.NewApp()
compose.CheckDockerComposeVersion()
app.Name = "ledo" app.Name = "ledo"
app.Usage = "LeadDocker helper for docker-compose work" app.Usage = "LeadDocker helper for docker-compose work"
app.Description = appDescription app.Description = appDescription