Fix :help with new config

This commit is contained in:
Florian Bruhin 2017-06-19 12:09:09 +02:00
parent e752f87876
commit ceca99a99c
2 changed files with 4 additions and 21 deletions

View File

@ -33,7 +33,7 @@ import pygments.lexers
import pygments.formatters
from qutebrowser.commands import userscripts, cmdexc, cmdutils, runners
from qutebrowser.config import config, configexc
from qutebrowser.config import config, configexc, configdata
from qutebrowser.browser import (urlmarks, browsertab, inspector, navigate,
webelem, downloads)
from qutebrowser.keyinput import modeman
@ -1540,21 +1540,8 @@ class CommandDispatcher:
raise cmdexc.CommandError("Invalid command {}!".format(
command))
path = 'commands.html#{}'.format(command)
elif '->' in topic:
# FIXME:conf refactor
parts = topic.split('->')
if len(parts) != 2:
raise cmdexc.CommandError("Invalid help topic {}!".format(
topic))
try:
config.instance.get(*parts)
except configexc.NoSectionError:
raise cmdexc.CommandError("Invalid section {}!".format(
parts[0]))
except configexc.NoOptionError:
raise cmdexc.CommandError("Invalid option {}!".format(
parts[1]))
path = 'settings.html#{}'.format(topic.replace('->', '-'))
elif topic in configdata.DATA:
path = 'settings.html#{}'.format(topic)
else:
raise cmdexc.CommandError("Invalid help topic {}!".format(topic))
url = QUrl('qute://help/{}'.format(path))

View File

@ -286,11 +286,7 @@ Feature: Various utility commands.
And I run :help editor.command
And I wait until qute://help/settings.html#editor.command is loaded
Then the following tabs should be open:
- qute://help/settings.html#general-editor (active)
Scenario: :help with invalid setting
When I run :help foo.bar
Then the error "Invalid option foo.bar!" should be shown
- qute://help/settings.html#editor.command (active)
Scenario: :help with -t
When I open about:blank