Get rid of --cycle for :set with multiple values

See https://github.com/The-Compiler/qutebrowser/pull/1840#issuecomment-258714784
This commit is contained in:
Florian Bruhin 2016-11-24 07:23:37 +01:00
parent 1b5664b72f
commit 3d140a1353
3 changed files with 6 additions and 13 deletions

View File

@ -149,7 +149,7 @@ Changed
- `ui -> window-title-format` now has a new `{backend} ` replacement
- `:hint` has a new `--add-history` argument to add the URL to the history for
yank/spawn targets.
- `:set` now has a `--cycle` flag which lets you cycle through multiple options.
- `:set` now cycles through values if more than one argument is given.
Deprecated
~~~~~~~~~~

View File

@ -778,7 +778,7 @@ class ConfigManager(QObject):
@cmdutils.argument('values', completion=Completion.value)
@cmdutils.argument('win_id', win_id=True)
def set_command(self, win_id, section_=None, option=None, *values,
temp=False, print_=False, cycle=False):
temp=False, print_=False):
"""Set an option.
If the option name ends with '?', the value of the option is shown
@ -796,7 +796,6 @@ class ConfigManager(QObject):
values: The value to set, or the values to cycle through.
temp: Set value temporarily.
print_: Print the value after setting.
cycle: Cycle through multiple provided values.
"""
if section_ is not None and option is None:
raise cmdexc.CommandError(
@ -825,8 +824,6 @@ class ConfigManager(QObject):
elif not values:
raise cmdexc.CommandError("set: The following arguments "
"are required: value")
elif not cycle and len(values) > 1:
raise cmdexc.CommandError("set: Too many values provided")
layer = 'temp' if temp else 'conf'
self._set_next(layer, section_, option, values)

View File

@ -15,10 +15,6 @@ Feature: Setting settings.
When I run :set colors statusbar.bg
Then the error "set: The following arguments are required: value" should be shown
Scenario: With too many values
When I run :set colors statusbar.bg green blue
Then the error "set: Too many values provided" should be shown
Scenario: Invalid section
When I run :set blah blub foo
Then the error "set: Section 'blah' does not exist!" should be shown
@ -38,22 +34,22 @@ Feature: Setting settings.
Scenario: Cycling an option
When I run :set colors statusbar.bg magenta
And I run :set --cycle colors statusbar.bg green magenta blue yellow
And I run :set colors statusbar.bg green magenta blue yellow
Then colors -> statusbar.bg should be blue
Scenario: Cycling an option through the end of the list
When I run :set colors statusbar.bg yellow
And I run :set --cycle colors statusbar.bg green magenta blue yellow
And I run :set colors statusbar.bg green magenta blue yellow
Then colors -> statusbar.bg should be green
Scenario: Cycling an option that's not on the list
When I run :set colors statusbar.bg red
And I run :set --cycle colors statusbar.bg green magenta blue yellow
And I run :set colors statusbar.bg green magenta blue yellow
Then colors -> statusbar.bg should be green
Scenario: Cycling through a single option
When I run :set colors statusbar.bg red
And I run :set --cycle colors statusbar.bg red
And I run :set colors statusbar.bg red
Then colors -> statusbar.bg should be red
Scenario: Getting an option