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:
parent
1b5664b72f
commit
3d140a1353
@ -149,7 +149,7 @@ Changed
|
|||||||
- `ui -> window-title-format` now has a new `{backend} ` replacement
|
- `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
|
- `:hint` has a new `--add-history` argument to add the URL to the history for
|
||||||
yank/spawn targets.
|
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
|
Deprecated
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
|
@ -778,7 +778,7 @@ class ConfigManager(QObject):
|
|||||||
@cmdutils.argument('values', completion=Completion.value)
|
@cmdutils.argument('values', completion=Completion.value)
|
||||||
@cmdutils.argument('win_id', win_id=True)
|
@cmdutils.argument('win_id', win_id=True)
|
||||||
def set_command(self, win_id, section_=None, option=None, *values,
|
def set_command(self, win_id, section_=None, option=None, *values,
|
||||||
temp=False, print_=False, cycle=False):
|
temp=False, print_=False):
|
||||||
"""Set an option.
|
"""Set an option.
|
||||||
|
|
||||||
If the option name ends with '?', the value of the option is shown
|
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.
|
values: The value to set, or the values to cycle through.
|
||||||
temp: Set value temporarily.
|
temp: Set value temporarily.
|
||||||
print_: Print the value after setting.
|
print_: Print the value after setting.
|
||||||
cycle: Cycle through multiple provided values.
|
|
||||||
"""
|
"""
|
||||||
if section_ is not None and option is None:
|
if section_ is not None and option is None:
|
||||||
raise cmdexc.CommandError(
|
raise cmdexc.CommandError(
|
||||||
@ -825,8 +824,6 @@ class ConfigManager(QObject):
|
|||||||
elif not values:
|
elif not values:
|
||||||
raise cmdexc.CommandError("set: The following arguments "
|
raise cmdexc.CommandError("set: The following arguments "
|
||||||
"are required: value")
|
"are required: value")
|
||||||
elif not cycle and len(values) > 1:
|
|
||||||
raise cmdexc.CommandError("set: Too many values provided")
|
|
||||||
|
|
||||||
layer = 'temp' if temp else 'conf'
|
layer = 'temp' if temp else 'conf'
|
||||||
self._set_next(layer, section_, option, values)
|
self._set_next(layer, section_, option, values)
|
||||||
|
@ -15,10 +15,6 @@ Feature: Setting settings.
|
|||||||
When I run :set colors statusbar.bg
|
When I run :set colors statusbar.bg
|
||||||
Then the error "set: The following arguments are required: value" should be shown
|
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
|
Scenario: Invalid section
|
||||||
When I run :set blah blub foo
|
When I run :set blah blub foo
|
||||||
Then the error "set: Section 'blah' does not exist!" should be shown
|
Then the error "set: Section 'blah' does not exist!" should be shown
|
||||||
@ -38,22 +34,22 @@ Feature: Setting settings.
|
|||||||
|
|
||||||
Scenario: Cycling an option
|
Scenario: Cycling an option
|
||||||
When I run :set colors statusbar.bg magenta
|
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
|
Then colors -> statusbar.bg should be blue
|
||||||
|
|
||||||
Scenario: Cycling an option through the end of the list
|
Scenario: Cycling an option through the end of the list
|
||||||
When I run :set colors statusbar.bg yellow
|
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
|
Then colors -> statusbar.bg should be green
|
||||||
|
|
||||||
Scenario: Cycling an option that's not on the list
|
Scenario: Cycling an option that's not on the list
|
||||||
When I run :set colors statusbar.bg red
|
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
|
Then colors -> statusbar.bg should be green
|
||||||
|
|
||||||
Scenario: Cycling through a single option
|
Scenario: Cycling through a single option
|
||||||
When I run :set colors statusbar.bg red
|
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
|
Then colors -> statusbar.bg should be red
|
||||||
|
|
||||||
Scenario: Getting an option
|
Scenario: Getting an option
|
||||||
|
Loading…
Reference in New Issue
Block a user