Add /plugins python_version command

This commit is contained in:
James Booth
2016-07-24 02:12:56 +01:00
parent b48a3d2f6a
commit 4209b1cf45
5 changed files with 26 additions and 5 deletions

View File

@@ -711,6 +711,7 @@ cmd_ac_init(void)
autocomplete_add(plugins_ac, "load");
autocomplete_add(plugins_ac, "unload");
autocomplete_add(plugins_ac, "reload");
autocomplete_add(plugins_ac, "python_version");
filepath_ac = autocomplete_new();

View File

@@ -1982,14 +1982,16 @@ static struct cmd_t command_defs[] =
"/plugins install <path>",
"/plugins unload <plugin>",
"/plugins load <plugin>",
"/plugins reload [<plugin>]")
"/plugins reload [<plugin>]",
"/plugins python_version")
CMD_DESC(
"Manage plugins. Passing no arguments lists currently loaded plugins.")
CMD_ARGS(
{ "install <file>", "Install file to plugins directory, and load or reload the plugin." },
{ "load <plugin>", "Load a plugin that already exists in the plugin directory." },
{ "unload <plugin>", "Unload a loaded plugin." },
{ "reload [<plugin>]", "Reload a plugin, passing no argument will reload all plugins" })
{ "reload [<plugin>]", "Reload a plugin, passing no argument will reload all plugins." },
{ "python_version", "Show the Python interpreter version." })
CMD_EXAMPLES(
"/plugin install /home/steveharris/Downloads/metal.py",
"/plugin load browser.py",

View File

@@ -84,6 +84,9 @@
#include "tray.h"
#endif
#include "tools/http_upload.h"
#ifdef HAVE_PYTHON
#include "plugins/python_plugins.h"
#endif
static void _update_presence(const resource_presence_t presence,
const char *const show, gchar **args);
@@ -6109,6 +6112,16 @@ cmd_plugins(ProfWin *window, const char *const command, gchar **args)
}
return TRUE;
} else if (g_strcmp0(args[0], "python_version") == 0) {
#ifdef HAVE_PYTHON
const char *version = python_get_version();
cons_show("Python version:");
cons_show("%s", version);
#else
cons_show("This build does not support pytyon plugins.");
#endif
return TRUE;
} else {
GList *plugins = plugins_loaded_list();
if (plugins == NULL) {