6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-12-12 14:17:46 +00:00

Enable/Disable multiple plugins in one command

This commit is contained in:
Régis Behmo 2019-07-07 08:21:14 +08:00 committed by Régis Behmo
parent e30bfec81c
commit 92fabd14b1
2 changed files with 16 additions and 11 deletions

View File

@ -4,6 +4,7 @@ Note: Breaking changes between versions are indicated by "💥".
## Latest ## Latest
- [Improvement] Make it possible to enable/disable multiple plugins at once
- [Improvement] Add 'local-docker-compose-nginx-volumes' patch - [Improvement] Add 'local-docker-compose-nginx-volumes' patch
## 3.5.3 (2019-07-05) ## 3.5.3 (2019-07-05)

View File

@ -32,10 +32,12 @@ def list_command(root):
@click.command(help="Enable a plugin") @click.command(help="Enable a plugin")
@opts.root @opts.root
@click.argument("plugin") @click.argument("plugin_names", metavar="plugin", nargs=-1)
def enable(root, plugin): def enable(root, plugin_names):
config = tutor_config.load_user(root) config = tutor_config.load_user(root)
plugins.enable(config, plugin) for plugin in plugin_names:
plugins.enable(config, plugin)
fmt.echo_info("Plugin {} enabled".format(plugin))
tutor_config.save(root, config) tutor_config.save(root, config)
fmt.echo_info( fmt.echo_info(
"You should now re-generate your environment with `tutor config save`." "You should now re-generate your environment with `tutor config save`."
@ -44,16 +46,18 @@ def enable(root, plugin):
@click.command(help="Disable a plugin") @click.command(help="Disable a plugin")
@opts.root @opts.root
@click.argument("plugin") @click.argument("plugin_names", metavar="plugin", nargs=-1)
def disable(root, plugin): def disable(root, plugin_names):
config = tutor_config.load_user(root) config = tutor_config.load_user(root)
plugins.disable(config, plugin) for plugin in plugin_names:
plugins.disable(config, plugin)
plugin_dir = tutor_env.pathjoin(root, "plugins", plugin)
if os.path.exists(plugin_dir):
shutil.rmtree(plugin_dir)
fmt.echo_info("Plugin {} disabled".format(plugin))
tutor_config.save(root, config) tutor_config.save(root, config)
plugin_dir = tutor_env.pathjoin(root, "plugins", plugin)
if os.path.exists(plugin_dir):
shutil.rmtree(plugin_dir)
fmt.echo_info( fmt.echo_info(
"You should now re-generate your environment with `tutor config save`." "You should now re-generate your environment with `tutor config save`."
) )