Skip to content

Commit

Permalink
fix(cli): export regression (#317)
Browse files Browse the repository at this point in the history
Accidentally inverted boolean logic, which yielded export unusable
  • Loading branch information
captncraig authored Jul 7, 2020
1 parent 823d150 commit 70c2cb3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cmd/tk/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ func exportCmd() *cli.Command {
path := filepath.Join(to, name+"."+*extension)

// Abort if already exists
if ok, err := fileExists(path); err != nil {
if exists, err := fileExists(path); err != nil {
return err
} else if !ok {
} else if exists {
return fmt.Errorf("File '%s' already exists. Aborting", path)
}

Expand All @@ -116,7 +116,10 @@ func fileExists(name string) (bool, error) {
if os.IsNotExist(err) {
return false, nil
}
return err != nil, err
if err != nil {
return false, err
}
return true, nil
}

func dirEmpty(dir string) (bool, error) {
Expand Down

0 comments on commit 70c2cb3

Please sign in to comment.