diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/Canasta-CLI.iml b/.idea/Canasta-CLI.iml new file mode 100644 index 0000000..5e764c4 --- /dev/null +++ b/.idea/Canasta-CLI.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..db233ae --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..e4ee489 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/internal/execute/execute.go b/internal/execute/execute.go index de1861b..3a6774a 100644 --- a/internal/execute/execute.go +++ b/internal/execute/execute.go @@ -12,6 +12,14 @@ import ( func Run(path, command string, cmdArgs ...string) (error, string) { var stdout bytes.Buffer var stderr bytes.Buffer + + isVerbose := logging.GetVerbose() + if isVerbose { + if command == "docker-compose" { + cmdArgs = append([]string{"--verbose"}, cmdArgs...) + } + } + logging.Print(fmt.Sprint(command, " ", strings.Join(cmdArgs, " "))) cmd := exec.Command("bash", "-c", command+" "+strings.Join(cmdArgs, " ")) cmd.Stdout = &stdout diff --git a/internal/logging/logging.go b/internal/logging/logging.go index 87d99b6..8e5acda 100644 --- a/internal/logging/logging.go +++ b/internal/logging/logging.go @@ -12,6 +12,10 @@ func SetVerbose(v bool) { verbose = v } +func GetVerbose() bool { + return verbose +} + func Print(output string) { log.SetFlags(0) if verbose {