Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ var file bool
var history bool
var pip bool

var save bool

var diffFlagMap = map[string]*bool{
"apt": &apt,
"node": &node,
Expand Down Expand Up @@ -120,10 +122,15 @@ var RootCmd = &cobra.Command{
}
fmt.Println()
glog.Info("Removing image file system directories from system")
errMsg := remove(image1.FSPath, true)
errMsg += remove(image2.FSPath, true)
if errMsg != "" {
glog.Error(errMsg)
if !save {
errMsg := remove(image1.FSPath, true)
errMsg += remove(image2.FSPath, true)
if errMsg != "" {
glog.Error(errMsg)
}
} else {
dir, _ := os.Getwd()
glog.Infof("Images were saved at %s as %s and %s", dir, image1.FSPath, image2.FSPath)
}
} else {
glog.Error(err.Error())
Expand Down Expand Up @@ -222,4 +229,5 @@ func init() {
RootCmd.Flags().BoolVarP(&apt, "apt", "a", false, "Set this flag to use the apt differ.")
RootCmd.Flags().BoolVarP(&file, "file", "f", false, "Set this flag to use the file differ.")
RootCmd.Flags().BoolVarP(&history, "history", "d", false, "Set this flag to use the dockerfile history differ.")
RootCmd.Flags().BoolVarP(&save, "save", "s", false, "Set this flag to save rather than remove the final image filesystems on exit.")
}