From 3cf4f668111ab9397e1c254eb9f2c4b1fb5a1670 Mon Sep 17 00:00:00 2001 From: pancake Date: Fri, 2 Dec 2022 14:55:42 +0100 Subject: [PATCH] Add "lua" as an alias for "#!lua" ##lang --- libr/core/cmd.c | 13 +++++++++++++ libr/core/core.c | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/libr/core/cmd.c b/libr/core/cmd.c index a66b4467ee..66fbb26732 100644 --- a/libr/core/cmd.c +++ b/libr/core/cmd.c @@ -77,6 +77,7 @@ static RCoreHelpMessage help_msg_dollar = { static RCoreHelpMessage help_msg_l = { "Usage:", "l[erls] [arg]", "Internal less (~..) and file listing (!ls)", + "lu", " [path]", "same as #!lua", "ll", " [path]", "same as ls -l", "lr", " [path]", "same as ls -r", "ls", " [-e,-l,-j,-q] [path]", "list files in current or given directory", @@ -1511,6 +1512,18 @@ static int cmd_l(void *data, const char *input) { // "l" } cmd_lr (core, arg); break; + case 'u': // "lu"(a) - short for #!lua + { + const char *arg = strchr (input, ' '); + if (arg) { + char *cmd = r_str_newf ("#!lua %s", r_str_trim_head_ro (arg + 1)); + r_core_cmd0 (core, cmd); + free (cmd); + } else { + r_core_cmd0 (core, "#!lua"); + } + } + break; case 's': // "ls" if (input[1] == '?') { r_core_cmd_help_match (core, help_msg_l, "ls", true); diff --git a/libr/core/core.c b/libr/core/core.c index a02b530738..02c8126cc9 100644 --- a/libr/core/core.c +++ b/libr/core/core.c @@ -2751,7 +2751,7 @@ static void __init_autocomplete_default(RCore* core) { ".", "..", ".*", "/F", "/m", "!", "!!", "#!c", "#!v", "#!cpipe", "#!qjs", "#!tiny", "#!vala", "v.", "#!rust", "#!zig", "#!pipe", "#!python", "aeli", "arp", "arpg", "dmd", "drp", "drpg", "oe", "ot", "o+", "o++", "on", "o", "idp", "idpi", "L", "obf", "o+", "oc", "of", "r2", "rabin2", "rasm2", "rahash2", "rax2", - "rafind2", "cd", "ls", "on", "wf", "rm", "wF", "wp", "Sd", "Sl", "to", "pm", + "rafind2", "cd", "ls", "lua", "on", "wf", "rm", "wF", "wp", "Sd", "Sl", "to", "pm", "/m", "zos", "zfd", "zfs", "zfz", "cat", "wta", "wtf", "wxf", "dml", "dd", "dd+", "vi", "vim", "nvi", "neovim", "nvim", "nano", #if __WINDOWS__