From 3d140a1353b82e06b795a6354903067489c3258b Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 24 Nov 2016 07:23:37 +0100 Subject: [PATCH] Get rid of --cycle for :set with multiple values See https://github.com/The-Compiler/qutebrowser/pull/1840#issuecomment-258714784 --- CHANGELOG.asciidoc | 2 +- qutebrowser/config/config.py | 5 +---- tests/end2end/features/set.feature | 12 ++++-------- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 4c3ebec9d..26b0b5552 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -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 ~~~~~~~~~~ diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index 3bf559e66..9e8f14621 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -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) diff --git a/tests/end2end/features/set.feature b/tests/end2end/features/set.feature index 76d92793b..769605c3e 100644 --- a/tests/end2end/features/set.feature +++ b/tests/end2end/features/set.feature @@ -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