check docker-compose version
This commit is contained in:
parent
b172d8f43d
commit
8a91f699b8
@ -16,7 +16,7 @@ var CmdComposeLogs = cli.Command{
|
||||
|
||||
func RunComposeLogs(cmd *cli.Context) error {
|
||||
ctx := context.InitCommand(cmd)
|
||||
compose.ExecComposerLogs(ctx)
|
||||
compose.ExecComposerLogs(ctx, cmd.Args())
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@ var CmdDockerUp = cli.Command{
|
||||
func RunComposeUp(cmd *cli.Context) error {
|
||||
ctx := context.InitCommand(cmd)
|
||||
compose.ExecComposerUp(ctx)
|
||||
compose.ExecComposerLogs(ctx, cmd.Args())
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ import (
|
||||
const DockerComposeVersion = ">= 1.28.6"
|
||||
|
||||
func CheckDockerComposeVersion() {
|
||||
// cmd := exec.Command("docker-compose", "--version")
|
||||
cmd := exec.Command("docker-compose", "--version")
|
||||
var output bytes.Buffer
|
||||
cmd.Stdout = &output
|
||||
@ -124,9 +125,10 @@ func ExecComposerRestart(ctx *context.LedoContext) {
|
||||
ctx.ExecCmd("docker-compose", args[0:])
|
||||
}
|
||||
|
||||
func ExecComposerLogs(ctx *context.LedoContext) {
|
||||
func ExecComposerLogs(ctx *context.LedoContext, command cli.Args) {
|
||||
args := ctx.ComposeArgs
|
||||
args = append(args, "logs", "--follow", "--tail", "100")
|
||||
args = append(args, command.Slice()...)
|
||||
ctx.ExecCmd("docker-compose", args[0:])
|
||||
}
|
||||
|
||||
|
2
main.go
2
main.go
@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"github.com/urfave/cli/v2"
|
||||
"ledo/app/cmd"
|
||||
"ledo/app/modules/compose"
|
||||
"os"
|
||||
)
|
||||
|
||||
@ -13,6 +14,7 @@ var (
|
||||
|
||||
func main() {
|
||||
app := cli.NewApp()
|
||||
compose.CheckDockerComposeVersion()
|
||||
app.Name = "ledo"
|
||||
app.Usage = "LeadDocker helper for docker-compose work"
|
||||
app.Description = appDescription
|
||||
|
Loading…
Reference in New Issue
Block a user