Skip to content

Commit

Permalink
Merge branch 'main' of github.com:quackduck/rem
Browse files Browse the repository at this point in the history
  • Loading branch information
quackduck committed Jun 18, 2022
2 parents 8817cb6 + b1e0c9b commit 7f300e1
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions rem.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ func main() {
}
// normal case
ensureTrashDir()
for i, filePath := range os.Args[1:] {
for i, filePath := range os.Args {
if i == 0 {
continue
}
if !ignoreArgs[i] {
trashFile(filePath)
}
Expand Down Expand Up @@ -167,8 +170,16 @@ func trashFile(path string) {
return
}
if !exists(path) {
handleErrStr(color.YellowString(path) + " does not exist")
return
fi, err := os.Lstat(path)
if err != nil {
handleErr(err)
return
}
if !(fi.Mode()&os.ModeSymlink == os.ModeSymlink) {
handleErrStr(color.YellowString(path) + " does not exist")
return
}
// the file is a broken symlink which will be deleted to match rm behavior
}
toMoveTo = getTimestampedPath(toMoveTo, exists)
path = getTimestampedPath(path, existsInLog)
Expand Down

0 comments on commit 7f300e1

Please sign in to comment.