about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-10-17 22:30:01 +0100
committerJames Booth <boothj5@gmail.com>2015-10-17 22:30:01 +0100
commita35cbea73273fb7e61218155ca1c28ebab73bb5b (patch)
tree8ac946f4912200120f5b4a0e9f46bb878b60f154 /src/command
parent0769fc6b1b0ec22d4e45f6cc033a642e25923930 (diff)
downloadprofani-tty-a35cbea73273fb7e61218155ca1c28ebab73bb5b.tar.gz
Implemented /script list
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c7
-rw-r--r--src/command/commands.c4
2 files changed, 6 insertions, 5 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 8b43ad21..35c2e32a 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -1693,19 +1693,17 @@ static struct cmd_t command_defs[] =
     },
 
     { "/script",
-        cmd_script, parse_args, 2, 2, NULL,
+        cmd_script, parse_args, 1, 2, NULL,
         CMD_NOTAGS
         CMD_SYN(
             "/script run <script>",
-            "/script remove <script>",
             "/script list",
             "/script show <script>")
         CMD_DESC(
-            "Manage and run command scripts. "
+            "Run command scripts. "
             "Scripts are stored in $XDG_DATA_HOME/profanity/scripts/ which is usually $HOME/.local/share/profanity/scripts/.")
         CMD_ARGS(
             { "script run <script>",    "Execute a script." },
-            { "script remove <script>", "Remove a script TODO." },
             { "script list",            "List all scripts TODO." },
             { "script show <script>",   "Show the commands in script TODO." })
         CMD_EXAMPLES(
@@ -2202,7 +2200,6 @@ cmd_init(void)
     script_ac = autocomplete_new();
     autocomplete_add(script_ac, "run");
     autocomplete_add(script_ac, "list");
-    autocomplete_add(script_ac, "remove");
     autocomplete_add(script_ac, "show");
 }
 
diff --git a/src/command/commands.c b/src/command/commands.c
index cbc37046..58f2a9b2 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -698,6 +698,10 @@ cmd_script(ProfWin *window, const char * const command, gchar **args)
         if (!res) {
             cons_show("Could not find script %s", args[1]);
         }
+    } else if (g_strcmp0(args[0], "list") == 0) {
+        GSList *scripts = scripts_list();
+        cons_show_scripts(scripts);
+        g_slist_free_full(scripts, g_free);
     } else {
         cons_bad_cmd_usage(command);
     }