Skip to content

Commit

Permalink
Merge pull request #483 from kool-dev/errors-handling
Browse files Browse the repository at this point in the history
`kool start` error message improv + verbose output improvement
  • Loading branch information
fabriciojs authored Nov 4, 2023
2 parents 852c3f0 + 89195e6 commit 95c3927
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions commands/start.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package commands

import (
"fmt"
"kool-dev/kool/core/builder"
"kool-dev/kool/core/environment"
"kool-dev/kool/core/network"
"kool-dev/kool/services/checker"
"kool-dev/kool/services/updater"
"strings"

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

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

Expand Down
8 changes: 4 additions & 4 deletions core/shell/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ func (s *DefaultShell) Exec(command builder.Command, extraArgs ...string) (outSt
}

if verbose {
fmt.Fprintf(s.ErrStream(), "$ (exec) %s %v\n",
fmt.Fprintf(s.ErrStream(), "$ (exec) %s %s\n",
exe,
args,
strings.Join(args, " "),
)
}

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

if verbose {
checker := NewTerminalChecker()
fmt.Fprintf(s.ErrStream(), "$ (TTY in: %v out: %v) %s %v\n",
fmt.Fprintf(s.ErrStream(), "$ (TTY in: %v out: %v) %s %s\n",
checker.IsTerminal(cmdptr.in),
checker.IsTerminal(cmdptr.out),
cmdptr.Command.Cmd(),
cmdptr.Command.Args(),
strings.Join(cmdptr.Command.Args(), " "),
)
}

Expand Down

0 comments on commit 95c3927

Please sign in to comment.