1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 20:36:38 +02:00

improve plugins/scripts completion template to use filename completion

This commit is contained in:
Emmanuel Bouthenot
2006-10-28 20:24:20 +00:00
parent 5473b39986
commit 7772bcfd33
10 changed files with 56 additions and 30 deletions
+1 -1
View File
@@ -2487,7 +2487,7 @@ weechat_plugin_init (t_weechat_plugin *plugin)
"filename: Lua script (file) to load\n"
"script: script name to unload\n\n"
"Without argument, /lua command lists all loaded Lua scripts.",
"load|autoload|reload|unload",
"load|autoload|reload|unload %f",
weechat_lua_cmd, NULL, NULL);
plugin->mkdir_home (plugin, "lua");
+1 -1
View File
@@ -2238,7 +2238,7 @@ weechat_plugin_init (t_weechat_plugin *plugin)
"filename: Perl script (file) to load\n"
"script: script name to unload\n\n"
"Without argument, /perl command lists all loaded Perl scripts.",
"load|autoload|reload|unload",
"load|autoload|reload|unload %f",
weechat_perl_cmd, NULL, NULL);
plugin->mkdir_home (plugin, "perl");
+1 -1
View File
@@ -2235,7 +2235,7 @@ weechat_plugin_init (t_weechat_plugin *plugin)
"filename: Python script (file) to load\n"
"script: script name to unload\n\n"
"Without argument, /python command lists all loaded Python scripts.",
"load|autoload|reload|unload",
"load|autoload|reload|unload %f",
weechat_python_cmd, NULL, NULL);
plugin->mkdir_home (plugin, "python");
+1 -1
View File
@@ -2464,7 +2464,7 @@ weechat_plugin_init (t_weechat_plugin *plugin)
"filename: Ruby script (file) to load\n"
"script: script name to unload\n\n"
"Without argument, /ruby command lists all loaded Ruby scripts.",
"load|autoload|reload|unload",
"load|autoload|reload|unload %f",
weechat_ruby_cmd, NULL, NULL);
plugin->mkdir_home (plugin, "ruby");
+24 -11
View File
@@ -110,14 +110,7 @@ weechat_script_search_full_name (t_weechat_plugin *plugin,
}
return NULL;
}
#ifdef _WIN32
if (strstr(filename, "\\"))
#else
if (strstr(filename, "/"))
#endif
return strdup(filename);
/* try WeeChat user's autoload dir */
dir_home = plugin->get_info (plugin, "weechat_dir", NULL);
if (dir_home)
@@ -137,7 +130,7 @@ weechat_script_search_full_name (t_weechat_plugin *plugin,
free (dir_home);
}
/* try WeeChat user's dir */
/* try WeeChat language user's dir */
dir_home = plugin->get_info (plugin, "weechat_dir", NULL);
if (dir_home)
{
@@ -156,6 +149,26 @@ weechat_script_search_full_name (t_weechat_plugin *plugin,
free (dir_home);
}
/* try WeeChat user's dir */
dir_home = plugin->get_info (plugin, "weechat_dir", NULL);
if (dir_home)
{
length = strlen (dir_home) + strlen (filename) + 16;
final_name = (char *) malloc (length);
plugin->print_server (plugin, "final=[%s]\n", final_name);
if (final_name)
{
snprintf (final_name, length, "%s/%s", dir_home, filename);
if ((stat (final_name, &st) == 0) && (st.st_size > 0))
{
free (dir_home);
return final_name;
}
free (final_name);
}
free (dir_home);
}
/* try WeeChat system dir */
dir_system = plugin->get_info (plugin, "weechat_sharedir", NULL);
if (dir_system)
@@ -174,8 +187,8 @@ weechat_script_search_full_name (t_weechat_plugin *plugin,
}
free (dir_system);
}
return NULL;
return strdup(filename);
}
/*