diff --git a/cmd/orchid/main.go b/cmd/orchid/main.go index 56b3fef..6ab431c 100644 --- a/cmd/orchid/main.go +++ b/cmd/orchid/main.go @@ -1,7 +1,6 @@ package main import ( - "errors" "flag" "github.com/1f349/mjwt" "github.com/1f349/orchid" @@ -109,17 +108,3 @@ func getWD(configPath string) (string, error) { } return filepath.Dir(wdAbs), nil } - -func trySetup(wd string) { - // handle potential errors during setup - err := runSetup(wd) - switch { - case errors.Is(err, errExitSetup): - // exit setup without questions - return - case err == nil: - return - default: - logger.Logger.Fatal("Failed to run setup", "err", err) - } -} diff --git a/cmd/orchid/setup.go b/cmd/orchid/setup.go index 018b540..114ed77 100644 --- a/cmd/orchid/setup.go +++ b/cmd/orchid/setup.go @@ -23,6 +23,20 @@ import ( var errExitSetup = errors.New("exit setup") +func trySetup(wd string) { + // handle potential errors during setup + err := runSetup(wd) + switch { + case errors.Is(err, errExitSetup): + // exit setup without questions + return + case err == nil: + return + default: + logger.Logger.Fatal("Failed to run setup", "err", err) + } +} + func runSetup(wd string) error { // ask about running the setup steps createFile := false