Added --dir,-d flag to :download-open
Updated documentation
This commit is contained in:
parent
4d9a634749
commit
78d1e362b8
|
|
@ -469,7 +469,7 @@ The index of the download to delete.
|
|||
|
||||
[[download-open]]
|
||||
=== download-open
|
||||
Syntax: +:download-open ['cmdline']+
|
||||
Syntax: +:download-open [*--dir*] ['cmdline']+
|
||||
|
||||
Open the last/[count]th download.
|
||||
|
||||
|
|
@ -480,6 +480,8 @@ If no specific command is given, this will use the system's default application
|
|||
present, the filename is automatically appended to the
|
||||
cmdline.
|
||||
|
||||
==== optional arguments
|
||||
* +*-d*+, +*--dir*+: Open the file's directory instead
|
||||
|
||||
==== count
|
||||
The index of the download to open.
|
||||
|
|
|
|||
|
|
@ -1097,7 +1097,8 @@ class DownloadModel(QAbstractListModel):
|
|||
|
||||
@cmdutils.register(instance='download-model', scope='window', maxsplit=0)
|
||||
@cmdutils.argument('count', value=cmdutils.Value.count)
|
||||
def download_open(self, cmdline: str = None, count: int = 0) -> None:
|
||||
@cmdutils.argument('dir', flag='d')
|
||||
def download_open(self, cmdline: str = None, count: int = 0, dir: bool = False) -> None:
|
||||
"""Open the last/[count]th download.
|
||||
|
||||
If no specific command is given, this will use the system's default
|
||||
|
|
@ -1109,6 +1110,7 @@ class DownloadModel(QAbstractListModel):
|
|||
present, the filename is automatically appended to the
|
||||
cmdline.
|
||||
count: The index of the download to open.
|
||||
dir: Whether to open the file's directory instead
|
||||
"""
|
||||
try:
|
||||
download = self[count - 1]
|
||||
|
|
@ -1119,7 +1121,10 @@ class DownloadModel(QAbstractListModel):
|
|||
count = len(self)
|
||||
raise cmdutils.CommandError("Download {} is not done!"
|
||||
.format(count))
|
||||
download.open_file(cmdline)
|
||||
if dir:
|
||||
download.open_file(cmdline, open_dir=True)
|
||||
else:
|
||||
download.open_file(cmdline)
|
||||
|
||||
@cmdutils.register(instance='download-model', scope='window')
|
||||
@cmdutils.argument('count', value=cmdutils.Value.count)
|
||||
|
|
|
|||
Loading…
Reference in New Issue