From 9e753c5c2867eb4ab85f92ac0e42be566727234c Mon Sep 17 00:00:00 2001 From: arbanhossain Date: Fri, 15 Apr 2022 20:26:31 +0600 Subject: [PATCH 1/6] added flag to exclude/disable plugins --- beets/ui/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index 365a0d529..19abb37bd 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -1127,6 +1127,10 @@ def _load_plugins(options, config): if len(options.plugins) > 0 else []) else: plugin_list = config['plugins'].as_str_seq() + + # Exclude any plugins that were specified on the command line + if options.exclude is not None: + plugin_list = [p for p in plugin_list if p not in options.exclude.split(',')] plugins.load_plugins(plugin_list) return plugins @@ -1261,6 +1265,8 @@ def _raw_main(args, lib=None): help='path to configuration file') parser.add_option('-p', '--plugins', dest='plugins', help='a comma-separated list of plugins to load') + parser.add_option('-x', '--exclude', dest='exclude', + help='a comma-separated list of plugins to disable') parser.add_option('-h', '--help', dest='help', action='store_true', help='show this help message and exit') parser.add_option('--version', dest='version', action='store_true', From 9dfb80b661525e38e32b8e851b40a2492f743f9c Mon Sep 17 00:00:00 2001 From: arbanhossain Date: Fri, 15 Apr 2022 20:26:54 +0600 Subject: [PATCH 2/6] documentation and changelog for --exclude flag --- docs/changelog.rst | 2 ++ docs/reference/cli.rst | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 4126a8cce..a86c975fb 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -20,6 +20,8 @@ New features: * :doc:`/plugins/convert`: Add a new `auto_keep` option that automatically converts files but keeps the *originals* in the library. :bug:`1840` :bug:`4302` +* Added a ``-x`` (or ``--exclude``) flag to specify one/multiple plugin(s) to be + disabled at startup. Bug fixes: diff --git a/docs/reference/cli.rst b/docs/reference/cli.rst index 214956873..4731dd0e7 100644 --- a/docs/reference/cli.rst +++ b/docs/reference/cli.rst @@ -445,6 +445,10 @@ import ...``. specified, the plugin list in your configuration is ignored. The long form of this argument also allows specifying no plugins, effectively disabling all plugins: ``--plugins=``. +* ``-x EXCLUDE``: specify a comma-separated list of plugins to disable in a + specific beets run. If specified, it will exclude plugins from your configuration + and/or plugins specified using the ``-p`` flag. To disable ALL plugins, use + ``--plugins=`` instead. Beets also uses the ``BEETSDIR`` environment variable to look for configuration and data. From 6be2617eb1170c798b577f890a32f2953d483bb8 Mon Sep 17 00:00:00 2001 From: arbanhossain Date: Sat, 16 Apr 2022 11:56:30 +0600 Subject: [PATCH 3/6] changed -x/--exclude flag to -P/--disable-plugin --- beets/ui/__init__.py | 7 ++++--- docs/changelog.rst | 2 +- docs/reference/cli.rst | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index 19abb37bd..2740c5f69 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -1127,10 +1127,11 @@ def _load_plugins(options, config): if len(options.plugins) > 0 else []) else: plugin_list = config['plugins'].as_str_seq() - + # Exclude any plugins that were specified on the command line if options.exclude is not None: - plugin_list = [p for p in plugin_list if p not in options.exclude.split(',')] + plugin_list = [p for p in plugin_list + if p not in options.exclude.split(',')] plugins.load_plugins(plugin_list) return plugins @@ -1265,7 +1266,7 @@ def _raw_main(args, lib=None): help='path to configuration file') parser.add_option('-p', '--plugins', dest='plugins', help='a comma-separated list of plugins to load') - parser.add_option('-x', '--exclude', dest='exclude', + parser.add_option('-P', '--disable-plugin', dest='exclude', help='a comma-separated list of plugins to disable') parser.add_option('-h', '--help', dest='help', action='store_true', help='show this help message and exit') diff --git a/docs/changelog.rst b/docs/changelog.rst index a86c975fb..ef9f550ff 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -20,7 +20,7 @@ New features: * :doc:`/plugins/convert`: Add a new `auto_keep` option that automatically converts files but keeps the *originals* in the library. :bug:`1840` :bug:`4302` -* Added a ``-x`` (or ``--exclude``) flag to specify one/multiple plugin(s) to be +* Added a ``-P`` (or ``--disable-plugin``) flag to specify one/multiple plugin(s) to be disabled at startup. Bug fixes: diff --git a/docs/reference/cli.rst b/docs/reference/cli.rst index 4731dd0e7..319a7897d 100644 --- a/docs/reference/cli.rst +++ b/docs/reference/cli.rst @@ -445,7 +445,7 @@ import ...``. specified, the plugin list in your configuration is ignored. The long form of this argument also allows specifying no plugins, effectively disabling all plugins: ``--plugins=``. -* ``-x EXCLUDE``: specify a comma-separated list of plugins to disable in a +* ``-P EXCLUDE``: specify a comma-separated list of plugins to disable in a specific beets run. If specified, it will exclude plugins from your configuration and/or plugins specified using the ``-p`` flag. To disable ALL plugins, use ``--plugins=`` instead. From 73554acfb06913173f839b143d512a79fcb50a6a Mon Sep 17 00:00:00 2001 From: arbanhossain Date: Sun, 17 Apr 2022 11:12:27 +0600 Subject: [PATCH 4/6] changed --disable-plugin to --disable-plugins --- beets/ui/__init__.py | 4 ++-- docs/changelog.rst | 2 +- docs/reference/cli.rst | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index 2740c5f69..acc1a7fc3 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -1131,7 +1131,7 @@ def _load_plugins(options, config): # Exclude any plugins that were specified on the command line if options.exclude is not None: plugin_list = [p for p in plugin_list - if p not in options.exclude.split(',')] + if p not in options.exclude.split(',')] plugins.load_plugins(plugin_list) return plugins @@ -1266,7 +1266,7 @@ def _raw_main(args, lib=None): help='path to configuration file') parser.add_option('-p', '--plugins', dest='plugins', help='a comma-separated list of plugins to load') - parser.add_option('-P', '--disable-plugin', dest='exclude', + parser.add_option('-P', '--disable-plugins', dest='exclude', help='a comma-separated list of plugins to disable') parser.add_option('-h', '--help', dest='help', action='store_true', help='show this help message and exit') diff --git a/docs/changelog.rst b/docs/changelog.rst index ef9f550ff..53d859f4b 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -20,7 +20,7 @@ New features: * :doc:`/plugins/convert`: Add a new `auto_keep` option that automatically converts files but keeps the *originals* in the library. :bug:`1840` :bug:`4302` -* Added a ``-P`` (or ``--disable-plugin``) flag to specify one/multiple plugin(s) to be +* Added a ``-P`` (or ``--disable-plugins``) flag to specify one/multiple plugin(s) to be disabled at startup. Bug fixes: diff --git a/docs/reference/cli.rst b/docs/reference/cli.rst index 319a7897d..a5f44f91f 100644 --- a/docs/reference/cli.rst +++ b/docs/reference/cli.rst @@ -445,9 +445,8 @@ import ...``. specified, the plugin list in your configuration is ignored. The long form of this argument also allows specifying no plugins, effectively disabling all plugins: ``--plugins=``. -* ``-P EXCLUDE``: specify a comma-separated list of plugins to disable in a - specific beets run. If specified, it will exclude plugins from your configuration - and/or plugins specified using the ``-p`` flag. To disable ALL plugins, use +* ``-P plugins``: specify a comma-separated list of plugins to disable in a + specific beets run. This will overwrite ``-p`` if used with it . To disable all plugins, use ``--plugins=`` instead. Beets also uses the ``BEETSDIR`` environment variable to look for From 58ea48aa3b9f06055102c13bedef16733801397c Mon Sep 17 00:00:00 2001 From: arbanhossain Date: Tue, 19 Apr 2022 11:22:31 +0600 Subject: [PATCH 5/6] removed over-indentation --- beets/ui/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index acc1a7fc3..900cb9305 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -1131,7 +1131,7 @@ def _load_plugins(options, config): # Exclude any plugins that were specified on the command line if options.exclude is not None: plugin_list = [p for p in plugin_list - if p not in options.exclude.split(',')] + if p not in options.exclude.split(',')] plugins.load_plugins(plugin_list) return plugins From 85db3059724fcce15b20af34e7d5374bf2ef1d72 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Tue, 19 Apr 2022 09:19:23 -0400 Subject: [PATCH 6/6] Remove errant space --- docs/reference/cli.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/cli.rst b/docs/reference/cli.rst index a5f44f91f..dad407489 100644 --- a/docs/reference/cli.rst +++ b/docs/reference/cli.rst @@ -446,7 +446,7 @@ import ...``. of this argument also allows specifying no plugins, effectively disabling all plugins: ``--plugins=``. * ``-P plugins``: specify a comma-separated list of plugins to disable in a - specific beets run. This will overwrite ``-p`` if used with it . To disable all plugins, use + specific beets run. This will overwrite ``-p`` if used with it. To disable all plugins, use ``--plugins=`` instead. Beets also uses the ``BEETSDIR`` environment variable to look for