@@ -183,18 +183,21 @@ class FOpenCmdbase(metaclass=CommandMeta):
183
183
'fileopen "that torrent" *.mkv mpv'
184
184
'fileopen "that torrent" *.mkv mpv --fullscreen' ,)
185
185
argspecs = (
186
+ {'names' : ('--quiet' , '-q' ),
187
+ 'description' : 'Suppress stdout from the external command. Pass twice to also suppress stderr' ,
188
+ 'action' : 'count' , 'default' : 0 },
186
189
make_X_FILTER_spec ('TORRENT' , or_focused = True , nargs = '?' ),
187
190
make_X_FILTER_spec ('FILE' , or_focused = True , nargs = '?' ),
188
- {" names" : ('COMMAND' ,),
189
- 'description' : " Command to use to open files. Default: xdg-open" ,
191
+ {' names' : ('COMMAND' ,),
192
+ 'description' : ' Command to use to open files. Default: xdg-open' ,
190
193
'nargs' : '?'
191
194
},
192
- {" names" : ('OPTS' ,),
195
+ {' names' : ('OPTS' ,),
193
196
'description' : "Options for the external command." ,
194
197
'nargs' : 'REMAINDER'
195
198
},
196
199
)
197
- async def run (self , TORRENT_FILTER , FILE_FILTER , COMMAND , OPTS ):
200
+ async def run (self , quiet , TORRENT_FILTER , FILE_FILTER , COMMAND , OPTS ):
198
201
default_command = 'xdg-open'
199
202
if COMMAND is None :
200
203
command = default_command
@@ -244,7 +247,11 @@ def closepipes(proc):
244
247
245
248
# TODO separate options for stdout/stderr
246
249
stdoutlogger = lambda s : self .info (command + ": " + s )
250
+ if quiet >= 1 :
251
+ stdoutlogger = lambda s : None
247
252
stderrlogger = lambda s : self .error (command + ": " + s )
253
+ if quiet >= 2 :
254
+ stderrlogger = lambda s : None
248
255
loop = asyncio .get_running_loop ()
249
256
try :
250
257
if command == default_command :
0 commit comments