Compare commits

...

2 commits

Author SHA1 Message Date
1ff3ca9ca2 This apparently got updated 2026-06-06 08:53:05 -05:00
b19f8ec039 Usage! 2026-06-06 08:53:05 -05:00

View file

@ -1,6 +1,6 @@
from beets import ui
from beets.ui import Subcommand, print_
from beets.ui.commands import print_and_modify
from beets.ui.commands.modify import print_and_modify
from beets.dbcore import FieldQuery
from beets.dbcore.query import SlowFieldSort
@ -65,11 +65,14 @@ action_map = {
}
def modify_labels(lib, opts, args):
if not args:
labels_command.parser.print_usage()
return
action = args[0]
if action not in action_map:
print_("%s is not a valid action. " % action)
print_("Valid actions are: add, remove, removeall, show, transfer, edit")
print_("%s is not a valid action. Run 'beet labels --help' for usage." % action)
return
actnum = action_map[action]
@ -297,7 +300,20 @@ def edit_labels(lib, opts, args):
print_(f"Updated {len(changes)} item(s).")
labels_command = Subcommand('labels', help='Add or remove labels')
labels_command = Subcommand(
'labels',
help='Add, remove, or inspect labels on library items'
)
labels_command.parser.usage = """%prog <action> [args] [query]
Actions:
add <label>[:<cost>] [query] Add a label (optionally with a cost value)
remove <label> [query] Remove a label from items
removeall [query] Remove all labels from items
show [query] Display labels on items
transfer <src-query> <dst-query>
Copy labels from one item to another
edit [query] Open items' labels in a text editor"""
labels_command.func = modify_labels
class HasLabelQuery(FieldQuery):