sindresorhus / macos-trash

Move files and folders to the trash
MIT License
374 stars 14 forks source link

add support for verbose flags #14

Closed ezrafree closed 3 years ago

ezrafree commented 3 years ago

This PR attempts to add support for verbose flags.

For example, suppose I've aliased rm to trash and I run the command rm -rfv <directory>. As a user, my expectation would be that the deleted filenames would be printed to the console.

I'm not a Swift developer by trade, so I'd be interested in learning more if anyone knows of a better way to check for the -v flag without having to use multiple switch cases, perhaps with a regex that checks if the string begins with a dash and contains a "v".

I would also be interested in knowing if there's a better way to implement this in general. For example, in this PR I'm printing the filename to the console before it actually tries to delete the file, which is obviously not ideal. It doesn't look like there are any other options that can be passed to FileManager.default.trashItem().


FIxes #13

sindresorhus commented 3 years ago

You need to document the flag in the readme.

sindresorhus commented 3 years ago

For example, in this PR I'm printing the filename to the console before it actually tries to delete the file, which is obviously not ideal.

What does rm do? Does it print before or after deleting the file?

sindresorhus commented 3 years ago

Bump