diff options
author | Philip Flohr <philip.flohr@student.kit.edu> | 2018-05-07 20:29:34 +0200 |
---|---|---|
committer | Dmitry Podgorny <pasis.ua@gmail.com> | 2018-09-06 19:28:02 +0300 |
commit | cd86f5bc288872ae8050c6f56515d4b8a5c77475 (patch) | |
tree | 7bfbea8d5cb4ca3037acb5e9a42a3c5367db627c /src/command | |
parent | e4ddced4203235c8393369ba3f0a62de1f5e980e (diff) | |
download | profani-tty-cd86f5bc288872ae8050c6f56515d4b8a5c77475.tar.gz |
added the possibility to uninstall a plugin
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/cmd_defs.c | 4 | ||||
-rw-r--r-- | src/command/cmd_funcs.c | 17 | ||||
-rw-r--r-- | src/command/cmd_funcs.h | 1 |
3 files changed, 22 insertions, 0 deletions
diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c index a523c939..54df4903 100644 --- a/src/command/cmd_defs.c +++ b/src/command/cmd_defs.c @@ -2084,6 +2084,7 @@ static struct cmd_t command_defs[] = CMD_SUBFUNCS( { "sourcepath", cmd_plugins_sourcepath }, { "install", cmd_plugins_install }, + { "uninstall", cmd_plugins_uninstall }, { "load", cmd_plugins_load }, { "unload", cmd_plugins_unload }, { "reload", cmd_plugins_reload }, @@ -2095,6 +2096,7 @@ static struct cmd_t command_defs[] = "/plugins sourcepath set <path>", "/plugins sourcepath clear", "/plugins install [<path>]", + "/plugins uninstall [<plugin>]", "/plugins unload [<plugin>]", "/plugins load [<plugin>]", "/plugins reload [<plugin>]", @@ -2105,6 +2107,7 @@ static struct cmd_t command_defs[] = { "sourcepath set <path>", "Set the default path to install plugins from, will be used if no arg is passed to /plugins install." }, { "sourcepath clear", "Clear the default plugins source path." }, { "install [<path>]", "Install a plugin, or all plugins found in a directory (recursive). Passing no argument will use the sourcepath if one is set." }, + { "uninstall [<plugin>]", "Uninstall a plugin." }, { "load [<plugin>]", "Load a plugin that already exists in the plugin directory, passing no argument loads all found plugins." }, { "unload [<plugin>]", "Unload a loaded plugin, passing no argument will unload all plugins." }, { "reload [<plugin>]", "Reload a plugin, passing no argument will reload all plugins." }, @@ -2113,6 +2116,7 @@ static struct cmd_t command_defs[] = "/plugins sourcepath set /home/meee/projects/profanity-plugins", "/plugins install", "/plugins install /home/steveharris/Downloads/metal.py", + "/plugins uninstall browser.py", "/plugins load browser.py", "/plugins unload say.py", "/plugins reload wikipedia.py") diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index a955e2f8..6aae8fb2 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -6664,6 +6664,23 @@ cmd_plugins_install(ProfWin *window, const char *const command, gchar **args) } gboolean +cmd_plugins_uninstall(ProfWin *window, const char *const command, gchar **args) +{ + if (args[1] == NULL) { + return FALSE; + } + + gboolean res = plugins_uninstall(args[1]); + if (res) { + cons_show("Uninstalled plugin: %s", args[1]); + } else { + cons_show("Failed to uninstall plugin: %s", args[1]); + } + + return TRUE; +} + +gboolean cmd_plugins_load(ProfWin *window, const char *const command, gchar **args) { if (args[1] == NULL) { diff --git a/src/command/cmd_funcs.h b/src/command/cmd_funcs.h index 0bbf338e..a00fce5d 100644 --- a/src/command/cmd_funcs.h +++ b/src/command/cmd_funcs.h @@ -162,6 +162,7 @@ gboolean cmd_console(ProfWin *window, const char *const command, gchar **args); gboolean cmd_plugins(ProfWin *window, const char *const command, gchar **args); gboolean cmd_plugins_sourcepath(ProfWin *window, const char *const command, gchar **args); gboolean cmd_plugins_install(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_plugins_uninstall(ProfWin *window, const char *const command, gchar **args); gboolean cmd_plugins_load(ProfWin *window, const char *const command, gchar **args); gboolean cmd_plugins_unload(ProfWin *window, const char *const command, gchar **args); gboolean cmd_plugins_reload(ProfWin *window, const char *const command, gchar **args); |