mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Remove /python sourcepath
I feel like this mostly is confusing people. Also don't see much value for it. To me it looks like a regular workflow is like: ``` /plugin install ~/src/profanity-plugins/my.py ``` The whole thing with sourcepath, install (which also loads without having that described anywhere), load etc is confusing. Also each plugin file that is present in `.local/share/profanity/plugins` will then be auto loaded. Which means after installation.
This commit is contained in:
parent
fd9ccec8dc
commit
3b3a6b7a75
@ -242,7 +242,6 @@ static Autocomplete console_ac;
|
||||
static Autocomplete console_msg_ac;
|
||||
static Autocomplete autoping_ac;
|
||||
static Autocomplete plugins_ac;
|
||||
static Autocomplete plugins_sourcepath_ac;
|
||||
static Autocomplete plugins_load_ac;
|
||||
static Autocomplete plugins_unload_ac;
|
||||
static Autocomplete plugins_reload_ac;
|
||||
@ -940,11 +939,6 @@ cmd_ac_init(void)
|
||||
autocomplete_add(plugins_ac, "unload");
|
||||
autocomplete_add(plugins_ac, "reload");
|
||||
autocomplete_add(plugins_ac, "python_version");
|
||||
autocomplete_add(plugins_ac, "sourcepath");
|
||||
|
||||
plugins_sourcepath_ac = autocomplete_new();
|
||||
autocomplete_add(plugins_sourcepath_ac, "set");
|
||||
autocomplete_add(plugins_sourcepath_ac, "clear");
|
||||
|
||||
filepath_ac = autocomplete_new();
|
||||
|
||||
@ -1355,7 +1349,6 @@ cmd_ac_reset(ProfWin* window)
|
||||
autocomplete_reset(console_msg_ac);
|
||||
autocomplete_reset(autoping_ac);
|
||||
autocomplete_reset(plugins_ac);
|
||||
autocomplete_reset(plugins_sourcepath_ac);
|
||||
autocomplete_reset(blocked_ac);
|
||||
autocomplete_reset(tray_ac);
|
||||
autocomplete_reset(presence_ac);
|
||||
@ -2638,21 +2631,10 @@ _plugins_autocomplete(ProfWin* window, const char* const input, gboolean previou
|
||||
{
|
||||
char* result = NULL;
|
||||
|
||||
if (strncmp(input, "/plugins sourcepath set ", 24) == 0) {
|
||||
return cmd_ac_complete_filepath(input, "/plugins sourcepath set", previous);
|
||||
}
|
||||
|
||||
if (strncmp(input, "/plugins install ", 17) == 0) {
|
||||
return cmd_ac_complete_filepath(input, "/plugins install", previous);
|
||||
}
|
||||
|
||||
if (strncmp(input, "/plugins sourcepath ", 20) == 0) {
|
||||
result = autocomplete_param_with_ac(input, "/plugins sourcepath", plugins_sourcepath_ac, TRUE, previous);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
if (strncmp(input, "/plugins load ", 14) == 0) {
|
||||
if (plugins_load_ac == NULL) {
|
||||
plugins_load_ac = autocomplete_new();
|
||||
|
@ -2136,7 +2136,6 @@ static struct cmd_t command_defs[] = {
|
||||
{ "/plugins",
|
||||
parse_args, 0, 3, NULL,
|
||||
CMD_SUBFUNCS(
|
||||
{ "sourcepath", cmd_plugins_sourcepath },
|
||||
{ "install", cmd_plugins_install },
|
||||
{ "uninstall", cmd_plugins_uninstall },
|
||||
{ "update", cmd_plugins_update },
|
||||
@ -2148,8 +2147,6 @@ static struct cmd_t command_defs[] = {
|
||||
CMD_NOTAGS
|
||||
CMD_SYN(
|
||||
"/plugins",
|
||||
"/plugins sourcepath set <path>",
|
||||
"/plugins sourcepath clear",
|
||||
"/plugins install [<path>]",
|
||||
"/plugins uninstall [<plugin>]",
|
||||
"/plugins update [<path>]",
|
||||
@ -2160,9 +2157,7 @@ static struct cmd_t command_defs[] = {
|
||||
CMD_DESC(
|
||||
"Manage plugins. Passing no arguments lists currently loaded plugins.")
|
||||
CMD_ARGS(
|
||||
{ "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." },
|
||||
{ "install [<path>]", "Install a plugin, or all plugins found in a directory (recursive)." },
|
||||
{ "uninstall [<plugin>]", "Uninstall a plugin." },
|
||||
{ "update [<path>]", "Updates an installed plugin" },
|
||||
{ "load [<plugin>]", "Load a plugin that already exists in the plugin directory, passing no argument loads all found plugins." },
|
||||
@ -2170,7 +2165,6 @@ static struct cmd_t command_defs[] = {
|
||||
{ "reload [<plugin>]", "Reload a plugin, passing no argument will reload all plugins." },
|
||||
{ "python_version", "Show the Python interpreter version." })
|
||||
CMD_EXAMPLES(
|
||||
"/plugins sourcepath set /home/meee/projects/profanity-plugins",
|
||||
"/plugins install",
|
||||
"/plugins install /home/steveharris/Downloads/metal.py",
|
||||
"/plugins update /home/steveharris/Downloads/metal.py",
|
||||
|
@ -6924,64 +6924,14 @@ cmd_receipts(ProfWin* window, const char* const command, gchar** args)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_plugins_sourcepath(ProfWin* window, const char* const command, gchar** args)
|
||||
{
|
||||
if (args[1] == NULL) {
|
||||
char* sourcepath = prefs_get_string(PREF_PLUGINS_SOURCEPATH);
|
||||
if (sourcepath) {
|
||||
cons_show("Current plugins sourcepath: %s", sourcepath);
|
||||
g_free(sourcepath);
|
||||
} else {
|
||||
cons_show("Plugins sourcepath not currently set.");
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_strcmp0(args[1], "clear") == 0) {
|
||||
prefs_set_string(PREF_PLUGINS_SOURCEPATH, NULL);
|
||||
cons_show("Plugins sourcepath cleared.");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_strcmp0(args[1], "set") == 0) {
|
||||
if (args[2] == NULL) {
|
||||
cons_bad_cmd_usage(command);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
char* path = get_expanded_path(args[2]);
|
||||
|
||||
if (!is_dir(path)) {
|
||||
cons_show("Plugins sourcepath must be a directory.");
|
||||
free(path);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
cons_show("Setting plugins sourcepath: %s", path);
|
||||
prefs_set_string(PREF_PLUGINS_SOURCEPATH, path);
|
||||
free(path);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
cons_bad_cmd_usage(command);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_plugins_install(ProfWin* window, const char* const command, gchar** args)
|
||||
{
|
||||
char* path;
|
||||
|
||||
if (args[1] == NULL) {
|
||||
char* sourcepath = prefs_get_string(PREF_PLUGINS_SOURCEPATH);
|
||||
if (sourcepath) {
|
||||
path = strdup(sourcepath);
|
||||
g_free(sourcepath);
|
||||
} else {
|
||||
cons_show("Either a path must be provided or the sourcepath property must be set, see /help plugins");
|
||||
return TRUE;
|
||||
}
|
||||
cons_show("Please provide a path to the plugin file or directory, see /help plugins");
|
||||
return TRUE;
|
||||
} else {
|
||||
path = get_expanded_path(args[1]);
|
||||
}
|
||||
@ -7046,14 +6996,8 @@ cmd_plugins_update(ProfWin* window, const char* const command, gchar** args)
|
||||
char* path;
|
||||
|
||||
if (args[1] == NULL) {
|
||||
char* sourcepath = prefs_get_string(PREF_PLUGINS_SOURCEPATH);
|
||||
if (sourcepath) {
|
||||
path = strdup(sourcepath);
|
||||
g_free(sourcepath);
|
||||
} else {
|
||||
cons_show("Either a path must be provided or the sourcepath property must be set, see /help plugins");
|
||||
return TRUE;
|
||||
}
|
||||
cons_show("Please provide a path to the plugin file or directory, see /help plugins");
|
||||
return TRUE;
|
||||
} else {
|
||||
path = get_expanded_path(args[1]);
|
||||
}
|
||||
|
@ -1928,8 +1928,6 @@ _get_group(preference_t pref)
|
||||
case PREF_BOOKMARK_INVITE:
|
||||
case PREF_ROOM_LIST_CACHE:
|
||||
return PREF_GROUP_MUC;
|
||||
case PREF_PLUGINS_SOURCEPATH:
|
||||
return PREF_GROUP_PLUGINS;
|
||||
case PREF_OMEMO_LOG:
|
||||
case PREF_OMEMO_POLICY:
|
||||
case PREF_OMEMO_TRUST_MODE:
|
||||
@ -2163,8 +2161,6 @@ _get_key(preference_t pref)
|
||||
return "color.occupants.nick";
|
||||
case PREF_BOOKMARK_INVITE:
|
||||
return "bookmark.invite";
|
||||
case PREF_PLUGINS_SOURCEPATH:
|
||||
return "sourcepath";
|
||||
case PREF_ROOM_LIST_CACHE:
|
||||
return "rooms.cache";
|
||||
case PREF_STATUSBAR_SHOW_NAME:
|
||||
|
@ -157,7 +157,6 @@ typedef enum {
|
||||
PREF_ROSTER_COLOR_NICK,
|
||||
PREF_OCCUPANTS_COLOR_NICK,
|
||||
PREF_BOOKMARK_INVITE,
|
||||
PREF_PLUGINS_SOURCEPATH,
|
||||
PREF_ROOM_LIST_CACHE,
|
||||
PREF_STATUSBAR_SHOW_NAME,
|
||||
PREF_STATUSBAR_SHOW_NUMBER,
|
||||
|
Loading…
Reference in New Issue
Block a user