This commit is contained in:
Benson Chu 2026-06-06 08:48:04 -05:00
parent e576ce1278
commit b19f8ec039

View file

@ -65,11 +65,14 @@ action_map = {
} }
def modify_labels(lib, opts, args): def modify_labels(lib, opts, args):
if not args:
labels_command.parser.print_usage()
return
action = args[0] action = args[0]
if action not in action_map: if action not in action_map:
print_("%s is not a valid action. " % action) print_("%s is not a valid action. Run 'beet labels --help' for usage." % action)
print_("Valid actions are: add, remove, removeall, show, transfer, edit")
return return
actnum = action_map[action] actnum = action_map[action]
@ -297,7 +300,20 @@ def edit_labels(lib, opts, args):
print_(f"Updated {len(changes)} item(s).") 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 labels_command.func = modify_labels
class HasLabelQuery(FieldQuery): class HasLabelQuery(FieldQuery):