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 import pygments.formatters
from qutebrowser.commands import userscripts, cmdexc, cmdutils, runners 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, from qutebrowser.browser import (urlmarks, browsertab, inspector, navigate,
webelem, downloads) webelem, downloads)
from qutebrowser.keyinput import modeman from qutebrowser.keyinput import modeman
@ -1540,21 +1540,8 @@ class CommandDispatcher:
raise cmdexc.CommandError("Invalid command {}!".format( raise cmdexc.CommandError("Invalid command {}!".format(
command)) command))
path = 'commands.html#{}'.format(command) path = 'commands.html#{}'.format(command)
elif '->' in topic: elif topic in configdata.DATA:
# FIXME:conf refactor path = 'settings.html#{}'.format(topic)
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('->', '-'))
else: else:
raise cmdexc.CommandError("Invalid help topic {}!".format(topic)) raise cmdexc.CommandError("Invalid help topic {}!".format(topic))
url = QUrl('qute://help/{}'.format(path)) url = QUrl('qute://help/{}'.format(path))

View File

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