Skip to content

Commit

Permalink
exec: Check for config file before trying to use it (#16)
Browse files Browse the repository at this point in the history
Updates the `exec` flow to check the `config` file exists before
attempting to pull data from it.

Fixes #12
  • Loading branch information
jacobbednarz authored Oct 18, 2020
1 parent 70ee123 commit 04d286d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ var execCmd = &cobra.Command{
if err != nil {
log.Fatal("unable to find home directory: ", err)
}

cfg, err := ini.Load(home + defaultFullConfigPath)
if err != nil {
log.Fatal("unable to use configuration file: ", err)
}

profileSection, err := cfg.GetSection("profile " + profileName)
if err != nil {
log.Fatal("unable to find profile: ", err)
Expand Down

0 comments on commit 04d286d

Please sign in to comment.