Skip to content

Commit 95c3927

Browse files
authored
Merge pull request #483 from kool-dev/errors-handling
`kool start` error message improv + verbose output improvement
2 parents 852c3f0 + 89195e6 commit 95c3927

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

commands/start.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package commands
22

33
import (
4+
"fmt"
45
"kool-dev/kool/core/builder"
56
"kool-dev/kool/core/environment"
67
"kool-dev/kool/core/network"
78
"kool-dev/kool/services/checker"
89
"kool-dev/kool/services/updater"
10+
"strings"
911

1012
"github.com/spf13/cobra"
1113
)
@@ -107,6 +109,9 @@ func (s *KoolStart) Execute(args []string) (err error) {
107109
}
108110

109111
if err = s.checkDependencies(); err != nil {
112+
if strings.HasPrefix(err.Error(), "no configuration file provided: not found") {
113+
err = fmt.Errorf("could not find docker-compose.yml - check your current working directory.\n\n[err: %v]", err)
114+
}
110115
return
111116
}
112117

core/shell/shell.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ func (s *DefaultShell) Exec(command builder.Command, extraArgs ...string) (outSt
136136
}
137137

138138
if verbose {
139-
fmt.Fprintf(s.ErrStream(), "$ (exec) %s %v\n",
139+
fmt.Fprintf(s.ErrStream(), "$ (exec) %s %s\n",
140140
exe,
141-
args,
141+
strings.Join(args, " "),
142142
)
143143
}
144144

@@ -174,11 +174,11 @@ func (s *DefaultShell) Interactive(originalCmd builder.Command, extraArgs ...str
174174

175175
if verbose {
176176
checker := NewTerminalChecker()
177-
fmt.Fprintf(s.ErrStream(), "$ (TTY in: %v out: %v) %s %v\n",
177+
fmt.Fprintf(s.ErrStream(), "$ (TTY in: %v out: %v) %s %s\n",
178178
checker.IsTerminal(cmdptr.in),
179179
checker.IsTerminal(cmdptr.out),
180180
cmdptr.Command.Cmd(),
181-
cmdptr.Command.Args(),
181+
strings.Join(cmdptr.Command.Args(), " "),
182182
)
183183
}
184184

0 commit comments

Comments
 (0)