Skip to content

Commit

Permalink
Error out when files are expected but not given.
Browse files Browse the repository at this point in the history
  • Loading branch information
Arkaeriit committed Dec 10, 2022
1 parent 74337dc commit e4ae9d6
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions rem.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,6 @@ with the exeption of the -q/--quiet flag. Run "rem --help" to know their usages.
// TODO: Multiple Rem instances could clobber log file. Fix using either file locks or tcp port locks.

func main() {
if len(os.Args) == 1 {
handleErrStr("too few arguments")
fmt.Println(helpMsg)
return
}

dataDir, _ = filepath.Abs(chooseDataDir())
ignoreArgs := make(map[int]bool, 3)
logFile = getLogFile()
Expand Down Expand Up @@ -242,6 +236,13 @@ func main() {
}
fileList := _fileList[0:index]

// Error out if there is no file to delete now
if len(fileList) == 0 && !flags.forceMode {
handleErrStr("too few arguments")
fmt.Println(helpMsg)
return
}

// Trashing files
if flags.permanentMode {
deleteFileList(fileList)
Expand Down

0 comments on commit e4ae9d6

Please sign in to comment.