generated from kurtosis-tech/package-template-repo
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove dive.json on clean command (#52)
- Loading branch information
1 parent
f52adff
commit 9e7619d
Showing
2 changed files
with
14 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ Copyright © 2023 Hugobyte AI Labs<[email protected]> | |
package clean | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/hugobyte/dive/common" | ||
"github.com/sirupsen/logrus" | ||
"github.com/spf13/cobra" | ||
|
@@ -17,6 +19,18 @@ func NewCleanCmd(diveContext *common.DiveContext) *cobra.Command { | |
Long: `Destroys and removes any running encalves. If no enclaves running to remove it will throw an error`, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
common.ValidateCmdArgs(args, cmd.UsageString()) | ||
pwd, err := os.Getwd() | ||
|
||
if err != nil { | ||
diveContext.FatalError("Failed cleaning with error: %v", err.Error()) | ||
} | ||
|
||
_, err = os.Stat(pwd + "/dive.json") | ||
|
||
if err == nil { | ||
os.Remove(pwd + "/dive.json") | ||
} | ||
|
||
enclaveName := diveContext.GetEnclaves() | ||
if enclaveName == "" { | ||
logrus.Errorf("No enclaves running to clean !!") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters