mirror of
https://github.com/beetbox/beets.git
synced 2025-12-16 05:34:47 +01:00
--version (fix #939)
This commit is contained in:
parent
6dd6d4770e
commit
832f34c46c
2 changed files with 10 additions and 2 deletions
|
|
@ -689,6 +689,8 @@ class SubcommandsOptionParser(optparse.OptionParser):
|
|||
help='path to configuration file')
|
||||
self.add_option('-h', '--help', dest='help', action='store_true',
|
||||
help='how this help message and exit')
|
||||
self.add_option('--version', dest='version', action='store_true',
|
||||
help=optparse.SUPPRESS_HELP)
|
||||
|
||||
# Our root parser needs to stop on the first unrecognized argument.
|
||||
self.disable_interspersed_args()
|
||||
|
|
@ -948,9 +950,14 @@ def _raw_main(args, lib=None):
|
|||
subcommands, plugins, lib = _setup(options, lib)
|
||||
|
||||
parser.add_subcommand(*subcommands)
|
||||
subcommand, suboptions, subargs = parser.parse_subcommand(subargs)
|
||||
|
||||
subcommand.func(lib, suboptions, subargs)
|
||||
if options.version:
|
||||
from beets.ui import commands
|
||||
commands.version_cmd.func(lib, None, None)
|
||||
else:
|
||||
subcommand, suboptions, subargs = parser.parse_subcommand(subargs)
|
||||
subcommand.func(lib, suboptions, subargs)
|
||||
|
||||
plugins.send('cli_exit', lib=lib)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ Fixes:
|
|||
* :doc:`/plugins/play`: Add a ``relative_to`` config option. Thanks to
|
||||
BrainDamage.
|
||||
* Fix a crash when a MusicBrainz release has zero tracks.
|
||||
* The ``--version`` flag now works as an alias for the ``version`` command.
|
||||
|
||||
.. _discogs_client: https://github.com/discogs/discogs_client
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue