diff options
author | Viachaslau Khalikin <viachaslau.vinegret@outlook.com> | 2022-09-20 04:30:11 +0300 |
---|---|---|
committer | Viachaslau Khalikin <viachaslau.vinegret@outlook.com> | 2022-09-20 04:30:11 +0300 |
commit | 0cb46460b38ba122787550235874d512be816c42 (patch) | |
tree | 5ae2ea17e4ea800ddf5ad44b630b196cd4febb42 /src | |
parent | d75e5c1c2859b287410c747c2ab4896f2880d3e6 (diff) | |
download | profani-tty-0cb46460b38ba122787550235874d512be816c42.tar.gz |
fix: print when no plugins installed
Signed-off-by: Viachaslau Khalikin <viachaslau.vinegret@outlook.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/command/cmd_funcs.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index 10f64d54..e8322214 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -7260,7 +7260,14 @@ cmd_plugins(ProfWin* window, const char* const command, gchar** args) } } + GList* plugins = plugins_loaded_list(); GSList* unloaded_plugins = plugins_unloaded_list(); + + if (plugins == NULL && unloaded_plugins == NULL) { + cons_show("No plugins installed."); + return TRUE; + } + if (unloaded_plugins) { GSList* curr = unloaded_plugins; cons_show("The following plugins already installed and can be loaded:"); @@ -7271,19 +7278,15 @@ cmd_plugins(ProfWin* window, const char* const command, gchar** args) g_slist_free_full(unloaded_plugins, g_free); } - GList* plugins = plugins_loaded_list(); - if (plugins == NULL) { - cons_show("No loaded plugins."); - return TRUE; - } - - GList* curr = plugins; - cons_show("Loaded plugins:"); - while (curr) { - cons_show(" %s", curr->data); - curr = g_list_next(curr); + if (plugins) { + GList* curr = plugins; + cons_show("Loaded plugins:"); + while (curr) { + cons_show(" %s", curr->data); + curr = g_list_next(curr); + } + g_list_free(plugins); } - g_list_free(plugins); return TRUE; } |