@@ -53,6 +53,7 @@ def __init__(self):
53
53
"tiebreak" : {},
54
54
"strict" : False ,
55
55
"tag" : "" ,
56
+ "remove" : False ,
56
57
}
57
58
)
58
59
@@ -131,6 +132,13 @@ def __init__(self):
131
132
action = "store" ,
132
133
help = "tag matched items with 'k=v' attribute" ,
133
134
)
135
+ self ._command .parser .add_option (
136
+ "-r" ,
137
+ "--remove" ,
138
+ dest = "remove" ,
139
+ action = "store_true" ,
140
+ help = "remove items from library" ,
141
+ )
134
142
self ._command .parser .add_all_common_options ()
135
143
136
144
def commands (self ):
@@ -141,6 +149,7 @@ def _dup(lib, opts, args):
141
149
copy = bytestring_path (self .config ["copy" ].as_str ())
142
150
count = self .config ["count" ].get (bool )
143
151
delete = self .config ["delete" ].get (bool )
152
+ remove = self .config ["remove" ].get (bool )
144
153
fmt = self .config ["format" ].get (str )
145
154
full = self .config ["full" ].get (bool )
146
155
keys = self .config ["keys" ].as_str_seq ()
@@ -196,6 +205,7 @@ def _dup(lib, opts, args):
196
205
copy = copy ,
197
206
move = move ,
198
207
delete = delete ,
208
+ remove = remove ,
199
209
tag = tag ,
200
210
fmt = fmt .format (obj_count ),
201
211
)
@@ -204,7 +214,14 @@ def _dup(lib, opts, args):
204
214
return [self ._command ]
205
215
206
216
def _process_item (
207
- self , item , copy = False , move = False , delete = False , tag = False , fmt = ""
217
+ self ,
218
+ item ,
219
+ copy = False ,
220
+ move = False ,
221
+ delete = False ,
222
+ tag = False ,
223
+ fmt = "" ,
224
+ remove = False ,
208
225
):
209
226
"""Process Item `item`."""
210
227
print_ (format (item , fmt ))
@@ -216,6 +233,8 @@ def _process_item(
216
233
item .store ()
217
234
if delete :
218
235
item .remove (delete = True )
236
+ if remove :
237
+ item .remove (delete = False )
219
238
if tag :
220
239
try :
221
240
k , v = tag .split ("=" )
0 commit comments