mirror of
https://github.com/beetbox/beets.git
synced 2025-12-31 13:02:47 +01:00
Allow exiting object selection early
This commit is contained in:
parent
b380a4c9a3
commit
bed3abd97a
4 changed files with 23 additions and 5 deletions
|
|
@ -408,9 +408,14 @@ def input_select_objects(prompt, objs, rep):
|
|||
out = []
|
||||
for obj in objs:
|
||||
rep(obj)
|
||||
if input_yn(u'%s? (yes/no)' % prompt, True):
|
||||
answer = input_options(
|
||||
('y', 'n', 'q'), True, u'%s? (yes/no/quit)' % prompt,
|
||||
u'Enter Y or N:'
|
||||
)
|
||||
if answer == u'y':
|
||||
out.append(obj)
|
||||
print() # go to a new line
|
||||
elif answer == u'q':
|
||||
return out
|
||||
return out
|
||||
|
||||
else: # No.
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ New features:
|
|||
example, ``beet modify -a artist:beatles artpath!`` resets ``artpath``
|
||||
attribute from matching albums back to the default value.
|
||||
:bug:`2497`
|
||||
* Modify selection can now be applied early without selecting every item.
|
||||
:bug:`3083`
|
||||
|
||||
Changes:
|
||||
|
||||
|
|
|
|||
|
|
@ -269,9 +269,10 @@ affected items in the library and asks for your permission before making any
|
|||
changes. You can then choose to abort the change (type `n`), confirm
|
||||
(`y`), or interactively choose some of the items (`s`). In the latter case,
|
||||
the command will prompt you for every matching item or album and invite you to
|
||||
type `y` or `n`. This option lets you choose precisely which data to change
|
||||
without spending too much time to carefully craft a query. To skip the prompts
|
||||
entirely, use the ``-y`` option.
|
||||
type `y` to apply the changes, `n` to discard them or `q` to exit and apply
|
||||
the selected changes. This option lets you choose precisely which data to
|
||||
change without spending too much time to carefully craft a query. To skip the
|
||||
prompts entirely, use the ``-y`` option.
|
||||
|
||||
.. _move-cmd:
|
||||
|
||||
|
|
|
|||
|
|
@ -73,6 +73,16 @@ class InputMethodsTest(_common.TestCase):
|
|||
lambda s: self._print_helper2(s, "Prefix"))
|
||||
self.assertEqual(items, ['1', '2', '4'])
|
||||
|
||||
# Test selective 3
|
||||
self.io.addinput('s')
|
||||
self.io.addinput('y')
|
||||
self.io.addinput('n')
|
||||
self.io.addinput('y')
|
||||
self.io.addinput('q')
|
||||
items = ui.input_select_objects(
|
||||
"Prompt", full_items, self._print_helper)
|
||||
self.assertEqual(items, ['1', '3'])
|
||||
|
||||
|
||||
class InitTest(_common.LibTestCase):
|
||||
def setUp(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue