Skip to content

Commit

Permalink
Implement the permanent mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
Arkaeriit committed Dec 10, 2022
1 parent 226073f commit 0d50d15
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion rem.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,11 @@ func main() {
fileList := _fileList[0:index]

// Trashing files
trashFileList(fileList)
if flags.permanentMode {
deleteFileList(fileList)
} else {
trashFileList(fileList)
}
}

// Trashes all the files in a list
Expand All @@ -212,6 +216,22 @@ func trashFileList(fileList []string) {
}
}

// Permanently deletes all the files in the list
func deleteFileList(fileList []string) {
color.Red("Warning, permanently deleting: ")
printFormattedList(fileList)
if promptBool("Confirm delete?") {
var err error
for _, filePath := range fileList {
err = permanentlyDeleteFile(filePath)
if err != nil {
fmt.Println("Could not delete " + filePath)
handleErr(err)
}
}
}
}

func restore(path string) {
path = filepath.Clean(path)
absPath, err := filepath.Abs(path)
Expand Down

0 comments on commit 0d50d15

Please sign in to comment.