beets/beets/ui/commands/help.py
Sebastian Mohr 59c93e7013 refactor: reorganize command modules and utils
Moved commands.py into commands/__init__.py for easier refactoring.
Moved `version` command into its own file.
Moved `help` command into its own file.
Moved `stats` command into its own file.
Moved `list` command into its own file.
Moved `config` command into its own file.
Moved `completion` command into its own file.
Moved utility functions into own file.
Moved `move` command into its own file.
Moved `fields` command into its own file.
Moved `update` command into its own file.
Moved `remove` command into its own file.
Moved `modify` command into its own file.
Moved `write` command into its own file.
Moved `import` command into its own folder, more commit following.
Moved ImportSession related functions into `importer/session.py`.
Moved import display display related functions into `importer/display.py`
Renamed import to import_ as a module cant be named import.
Fixed imports in init file.
2025-11-03 13:32:14 +01:00

22 lines
643 B
Python

"""The 'help' command: show help information for commands."""
from beets import ui
class HelpCommand(ui.Subcommand):
def __init__(self):
super().__init__(
"help",
aliases=("?",),
help="give detailed help on a specific sub-command",
)
def func(self, lib, opts, args):
if args:
cmdname = args[0]
helpcommand = self.root_parser._subcommand_for_name(cmdname)
if not helpcommand:
raise ui.UserError(f"unknown command '{cmdname}'")
helpcommand.print_help()
else:
self.root_parser.print_help()