Update docs

This commit is contained in:
Florian Bruhin 2018-10-07 17:01:56 +02:00
parent 927c2ff94a
commit 6168622de3
4 changed files with 39 additions and 8 deletions

View File

@ -25,6 +25,8 @@ Added
opened from a page should stack on each other or not.
- New `completion.open_categories` setting which allows to configure which
categories are shown in the `:open` completion, and how they are ordered.
- New `:config-add-dict` and `:config-add-list` commands to easily add a new
element to a dict/list setting.
Changed
~~~~~~~

View File

@ -36,6 +36,8 @@ It is possible to run or bind multiple commands by separating them with `;;`.
|<<clear-messages,clear-messages>>|Clear all message notifications.
|<<click-element,click-element>>|Click the element matching the given filter.
|<<close,close>>|Close the current window.
|<<config-add-dict,config-add-dict>>|Add a key/value pair to a dictionary option.
|<<config-add-list,config-add-list>>|Append a value to a config option that is a list.
|<<config-clear,config-clear>>|Set all settings back to their default.
|<<config-cycle,config-cycle>>|Cycle an option between multiple values.
|<<config-edit,config-edit>>|Open the config.py file in the editor.
@ -266,6 +268,35 @@ The given filter needs to result in exactly one element, otherwise, an error is
=== close
Close the current window.
[[config-add-dict]]
=== config-add-dict
Syntax: +:config-add-dict [*--temp*] [*--replace*] 'option' 'key' 'value'+
Add a key/value pair to a dictionary option.
==== positional arguments
* +'option'+: The name of the option.
* +'key'+: The key to use.
* +'value'+: The value to place in the dictionary.
==== optional arguments
* +*-t*+, +*--temp*+: Set value temporarily until qutebrowser is closed.
* +*-r*+, +*--replace*+: Replace existing values. By default, existing values are not overwritten.
[[config-add-list]]
=== config-add-list
Syntax: +:config-add-list [*--temp*] 'option' 'value'+
Append a value to a config option that is a list.
==== positional arguments
* +'option'+: The name of the option.
* +'value'+: The value to append to the end of the list.
==== optional arguments
* +*-t*+, +*--temp*+: Set value temporarily until qutebrowser is closed.
[[config-clear]]
=== config-clear
Syntax: +:config-clear [*--save*]+
@ -326,7 +357,7 @@ This sets an option back to its default and removes it from autoconfig.yml.
* +'option'+: The name of the option.
==== optional arguments
* +*-t*+, +*--temp*+: Don't touch autoconfig.yml.
* +*-t*+, +*--temp*+: Set value temporarily until qutebrowser is closed.
[[config-write-py]]
=== config-write-py

View File

@ -55,13 +55,13 @@ def dict_option(*, info):
def _option(info, title, predicate):
"""A CompletionModel that is generified for several option sets.
"""A CompletionModel that is generated for several option sets.
Args:
info: The config info that can be passed through.
title: The title of the options.
predicate: The function for filtering out the options. Takes a single
argument.
argument.
"""
model = completionmodel.CompletionModel(column_widths=(20, 70, 10))
options = ((opt.name, opt.description, info.config.get_str(opt.name))

View File

@ -274,17 +274,15 @@ class ConfigCommands:
@cmdutils.register(instance='config-commands')
@cmdutils.argument('option', completion=configmodel.dict_option)
def config_add_dict(self, option, key, value, temp=False, replace=False):
"""Add a value at the key within the option specified.
This adds an element to a dictionary. --replace is needed to override
existing values.
"""Add a key/value pair to a dictionary option.
Args:
option: The name of the option.
key: The key to use.
value: The value to place in the dictionary.
temp: Set value temporarily until qutebrowser is closed.
replace: Whether or not we should replace, default is not.
replace: Replace existing values. By default, existing values are
not overwritten.
"""
opt = self._config.get_opt(option)
if not isinstance(opt.typ, configtypes.Dict):