Move split_cmdline to commands.parsers
This commit is contained in:
parent
deb286272c
commit
fd3262e2ba
@ -232,3 +232,21 @@ class CommandParser(QObject):
|
||||
raise
|
||||
self._run(count=count)
|
||||
return True
|
||||
|
||||
|
||||
def split_cmdline(text):
|
||||
"""Split a commandline into it's logical parts.
|
||||
|
||||
Arguments:
|
||||
text: The string to split.
|
||||
|
||||
Return:
|
||||
A list of strings.
|
||||
|
||||
"""
|
||||
parser = CommandParser()
|
||||
try:
|
||||
parts = parser.parse(text)
|
||||
except NoSuchCommandError:
|
||||
parts = text.split(' ')
|
||||
return parts
|
||||
|
@ -34,9 +34,8 @@ from PyQt5.QtGui import (QIcon, QPalette, QTextDocument, QTextOption,
|
||||
|
||||
import qutebrowser.config.config as config
|
||||
import qutebrowser.commands.utils as cmdutils
|
||||
from qutebrowser.commands.parsers import CommandParser
|
||||
from qutebrowser.commands.exceptions import NoSuchCommandError
|
||||
from qutebrowser.config.style import get_stylesheet
|
||||
from qutebrowser.commands.parsers import split_cmdline
|
||||
from qutebrowser.models.completionfilter import CompletionFilterModel
|
||||
from qutebrowser.models.commandcompletion import CommandCompletionModel
|
||||
from qutebrowser.models.settingcompletion import SettingCompletionModel
|
||||
@ -220,12 +219,7 @@ class CompletionView(QTreeView):
|
||||
return
|
||||
|
||||
text = text.lstrip(':')
|
||||
parser = CommandParser()
|
||||
try:
|
||||
parts = parser.parse(text)
|
||||
except NoSuchCommandError:
|
||||
parts = text.split(' ')
|
||||
logging.debug("parts: {}".format(parts))
|
||||
parts = split_cmdline(text)
|
||||
|
||||
model = self._get_new_completion(parts)
|
||||
if model != self._lastmodel:
|
||||
|
Loading…
Reference in New Issue
Block a user