Changed code and docs according to comments

This commit is contained in:
Peter Michely 2015-10-08 10:13:47 +02:00
parent 10f4798559
commit bfccb91e42
4 changed files with 13 additions and 9 deletions

View File

@ -261,7 +261,7 @@ Start hinting.
- With `spawn`: The executable and arguments to spawn.
`{hint-url}` will get replaced by the selected
URL.
- With `userscript`: The userscript to execute. Either store the userscript in your data directory or use an absolute path.
- With `userscript`: The userscript to execute.
- With `fill`: The command to fill the statusbar with.
`{hint-url}` will get replaced by the selected
URL.
@ -580,7 +580,7 @@ Note the {url} variable which gets replaced by the current URL might be useful h
* +'cmdline'+: The commandline to execute.
==== optional arguments
* +*-u*+, +*--userscript*+: Run the command as a userscript. Either store it in your data directory or use an absolute path.
* +*-u*+, +*--userscript*+: Run the command as a userscript.
* +*-v*+, +*--verbose*+: Show notifications when the command started/exited.
* +*-d*+, +*--detach*+: Whether the command should be detached from qutebrowser.

View File

@ -948,7 +948,9 @@ class CommandDispatcher:
useful here.
Args:
userscript: Run the command as a userscript.
userscript: Run the command as a userscript. Either store the
userscript in ~/.local/share/qutebrowser/userscripts
(or $XDG_DATA_DIR), or use an absolute path.
verbose: Show notifications when the command started/exited.
detach: Whether the command should be detached from qutebrowser.
cmdline: The commandline to execute.

View File

@ -749,7 +749,10 @@ class HintManager(QObject):
- With `spawn`: The executable and arguments to spawn.
`{hint-url}` will get replaced by the selected
URL.
- With `userscript`: The userscript to execute.
- With `userscript`: The userscript to execute. Either store
the userscript in
~/.local/share/qutebrowser/userscripts (or
$XDG_DATA_DIR), or use an absolute path.
- With `fill`: The command to fill the statusbar with.
`{hint-url}` will get replaced by the selected
URL.

View File

@ -345,12 +345,11 @@ def run(cmd, *args, win_id, env, verbose=False):
env['QUTE_USER_AGENT'] = user_agent
cmd = os.path.expanduser(cmd)
# check if userscript is in absolute path or in $XDG_DATA_DIRS
# if cmd is not given as an absolute path, look it up
# ~/.local/share/qutebrowser/userscripts (or $XDG_DATA_DIR)
if not os.path.isabs(cmd):
log.misc.debug("{} is no absoulte path".format(cmd))
c = os.path.join(standarddir.data(), "userscripts", cmd)
if os.path.isfile(c):
cmd = c
log.misc.debug("{} is no absolute path".format(cmd))
cmd = os.path.join(standarddir.data(), "userscripts", cmd)
runner.run(cmd, *args, env=env, verbose=verbose)
runner.finished.connect(commandrunner.deleteLater)