New issue 68 by icu...@gmail.com: trash-put --force option enabled.
http://code.google.com/p/trash-cli/issues/detail?id=68
What steps will reproduce the problem?
1. trash-put --force option is not compatibility with rm -f.
What is the expected output? What do you see instead?
As you know,
$ rm -f foo
is fine. But,
$ trash-put -f foo
trash-put: trash: cannot trash entry `foo': [Errno 2] No such file or
directory: 'foo'
is not fine.
What version of the product are you using? On what operating system?
Please provide any additional information below.
I tried to replace rm with trash-put. But many scripts failed.
So, I modified this.
Index: trashcli/cli/put.py
===================================================================
--- trashcli/cli/put.py (revision 317)
+++ trashcli/cli/put.py (working copy)
@@ -34,7 +34,8 @@
if len(args) <= 0:
parser.error("Please specify the files to trash.")
- reporter=Reporter(self.get_logger(options.verbose,argv[0]))
+ reporter=Reporter(self.get_logger(options.verbose,argv[0]),
+ options.force)
self.trashcan=GlobalTrashCan(reporter=reporter)
self.trash_all(args)
@@ -71,7 +72,8 @@
parser.add_option("-f",
"--force",
action="store_true",
- help="ignored (for GNU rm compatibility)")
+ help="ignored (for GNU rm compatibility)",
+ dest="force")
parser.add_option("-i",
"--interactive",
action="store_true",
@@ -105,14 +107,17 @@
return MyLogger(self.stderr)
class Reporter:
- def __init__(self, logger):
+ def __init__(self, logger, force):
self.logger = logger
+ self.force = force
def unable_to_trash_dot_entries(self,file):
- self.logger.warning("cannot trash %s `%s'" % (file.type_description(),
file))
+ if not self.force:
+ self.logger.warning("cannot trash %s `%s'" %
(file.type_description(), file))
def unable_to_trash_file(self,f):
- self.logger.warning("cannot trash %s `%s'" % (f.type_description(), f))
+ if not self.force:
+ self.logger.warning("cannot trash %s `%s'" % (f.type_description(),
f))
def file_has_been_trashed_in_as(self, trashee, trash_directory,
destination):
self.logger.info("`%s' trashed in %s " % (trashee, trash_directory))
Comment #1 on issue 68 by andrea.f...@gmail.com: trash-put --force option
enabled.
http://code.google.com/p/trash-cli/issues/detail?id=68
Thank you for the patch, but I can't include it without an associated
automatic test.