Skip to content

Commit

Permalink
Removes .odo folder if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
mik-dass committed Apr 15, 2020
1 parent 959a954 commit 4299c56
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 9 additions & 0 deletions pkg/odo/cli/component/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,15 @@ func (do *DeleteOptions) DevFileRun() (err error) {
if err != nil {
return err
}

cfg, err := config.NewLocalConfigInfo(do.componentContext)
if err != nil {
return err
}
if err = cfg.DeleteConfigDirIfEmpty(); err != nil {
return err
}

log.Successf("Successfully deleted env file")
} else {
log.Error("Aborting deletion of env folder")
Expand Down
5 changes: 2 additions & 3 deletions tests/integration/devfile/cmd_devfile_delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,8 @@ var _ = Describe("odo devfile delete command tests", func() {

oc.WaitAndCheckForExistence("deployments", namespace, 1)

files := helper.ListFilesInDir(filepath.Join(context, ".odo"))
Expect(files).To(Not(ContainElement("env")))
Expect(files).To(Not(ContainElement("odo-file-index.json")))
files := helper.ListFilesInDir(context)
Expect(files).To(Not(ContainElement(".odo")))
})
})
})

0 comments on commit 4299c56

Please sign in to comment.