summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2022-03-25 12:31:02 +0100
committerGitHub <[email protected]>2022-03-25 12:31:02 +0100
commite95148df24093f99bea886cf4b55689d3b975313 (patch)
treeb75763b37873f1550b2c109d8a4168a69e0efc0f /internal
parent60fe20ac6e937a9a53ea0cb4d97656e0e970ec58 (diff)
[#1075]: chore(work_dir): change wd before searching for the config
Diffstat (limited to 'internal')
-rw-r--r--internal/cli/root.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/cli/root.go b/internal/cli/root.go
index f71368f1..7e22124a 100644
--- a/internal/cli/root.go
+++ b/internal/cli/root.go
@@ -46,6 +46,12 @@ func NewCommand(cmdName string) *cobra.Command { //nolint:funlen
return errors.Str("no configuration file provided")
}
+ if workDir != "" {
+ if err := os.Chdir(workDir); err != nil {
+ return err
+ }
+ }
+
if absPath, err := filepath.Abs(*cfgFile); err == nil {
*cfgFile = absPath // switch config path to the absolute
@@ -55,12 +61,6 @@ func NewCommand(cmdName string) *cobra.Command { //nolint:funlen
}
}
- if workDir != "" {
- if err := os.Chdir(workDir); err != nil {
- return err
- }
- }
-
if v, ok := os.LookupEnv(envDotenv); ok { // read path to the dotenv file from environment variable
dotenv = v
}