Add :config-diff command
This commit is contained in:
parent
1b7946ed14
commit
152d789a03
|
|
@ -35,6 +35,7 @@ Added
|
|||
- New `:debug-keytester` command, which shows a "key tester" widget.
|
||||
Previously, that was only available as a separate application via `python3 -m
|
||||
scripts.keytester`.
|
||||
- New `:config-diff` command which opens the `qute://configdiff` page.
|
||||
|
||||
Fixed
|
||||
~~~~~
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ possible to run or bind multiple commands by separating them with `;;`.
|
|||
|<<config-cycle,config-cycle>>|Cycle an option between multiple values.
|
||||
|<<config-dict-add,config-dict-add>>|Add a key/value pair to a dictionary option.
|
||||
|<<config-dict-remove,config-dict-remove>>|Remove a key from a dict.
|
||||
|<<config-diff,config-diff>>|Show all customized options.
|
||||
|<<config-edit,config-edit>>|Open the config.py file in the editor.
|
||||
|<<config-list-add,config-list-add>>|Append a value to a config option that is a list.
|
||||
|<<config-list-remove,config-list-remove>>|Remove a value from a list.
|
||||
|
|
@ -328,6 +329,16 @@ Remove a key from a dict.
|
|||
==== optional arguments
|
||||
* +*-t*+, +*--temp*+: Remove value temporarily until qutebrowser is closed.
|
||||
|
||||
[[config-diff]]
|
||||
=== config-diff
|
||||
Syntax: +:config-diff [*--old*]+
|
||||
|
||||
Show all customized options.
|
||||
|
||||
==== optional arguments
|
||||
* +*-o*+, +*--old*+: Show difference for the pre-v1.0 files (qutebrowser.conf/keys.conf).
|
||||
|
||||
|
||||
[[config-edit]]
|
||||
=== config-edit
|
||||
Syntax: +:config-edit [*--no-source*]+
|
||||
|
|
|
|||
|
|
@ -261,6 +261,23 @@ class ConfigCommands:
|
|||
with self._handle_config_error():
|
||||
self._config.unset(option, save_yaml=not temp)
|
||||
|
||||
@cmdutils.register(instance='config-commands')
|
||||
@cmdutils.argument('win_id', value=cmdutils.Value.win_id)
|
||||
def config_diff(self, win_id: int, old: bool = False) -> None:
|
||||
"""Show all customized options.
|
||||
|
||||
Args:
|
||||
old: Show difference for the pre-v1.0 files
|
||||
(qutebrowser.conf/keys.conf).
|
||||
"""
|
||||
url = QUrl('qute://configdiff')
|
||||
if old:
|
||||
url.setPath('/old')
|
||||
|
||||
tabbed_browser = objreg.get('tabbed-browser',
|
||||
scope='window', window=win_id)
|
||||
tabbed_browser.load_url(url, newtab=False)
|
||||
|
||||
@cmdutils.register(instance='config-commands')
|
||||
@cmdutils.argument('option', completion=configmodel.list_option)
|
||||
def config_list_add(self, option: str, value: str,
|
||||
|
|
|
|||
|
|
@ -212,6 +212,16 @@ class TestSet:
|
|||
commands.set(win_id=0, option='foo?')
|
||||
|
||||
|
||||
@pytest.mark.parametrize('old', [True, False])
|
||||
def test_diff(commands, tabbed_browser_stubs, old):
|
||||
"""Run ':config-diff'.
|
||||
|
||||
Should open qute://configdiff."""
|
||||
commands.config_diff(win_id=0, old=old)
|
||||
url = QUrl('qute://configdiff/old') if old else QUrl('qute://configdiff')
|
||||
assert tabbed_browser_stubs[0].loaded_url == url
|
||||
|
||||
|
||||
class TestCycle:
|
||||
|
||||
"""Test :config-cycle."""
|
||||
|
|
|
|||
Loading…
Reference in New Issue