Implement oe command to open a file using cfg.editor ##shell

This commit is contained in:
pancake 2022-11-25 02:28:08 +01:00 committed by pancake
parent db225c212d
commit 5cbd085902
2 changed files with 11 additions and 2 deletions

View File

@ -22,6 +22,7 @@ static const char *help_msg_o[] = {
"ob","[?] [lbdos] [...]","list opened binary files backed by fd",
"oc"," [file]","open core file, like relaunching r2",
"of","[?] [file]","open file without creating any map",
"oe"," [filename]","open cfg.editor with given file",
"oj","[?]","list opened files in JSON format",
"om","[?]","create, list, remove IO maps",
"on","[?][n] [file] 0x4000","map raw file at 0x4000 (no r_bin involved)",
@ -1829,6 +1830,14 @@ static int cmd_open(void *data, const char *input) {
r_core_return_value (core, fd);
r_core_block_read (core);
return 0;
case 'e': // "oe"
if (input[1] == ' ') {
const char *arg = r_str_trim_head_ro (input + 1);
free (r_core_editor (core, arg, NULL));
} else {
r_core_cmd_help_match (core, help_msg_o, "oe", false);
}
return 0;
// XXX projects use the of command, but i think we should deprecate it... keeping it for now
case 'f': // "of"
if (input[1]) {

View File

@ -1055,7 +1055,7 @@ static const char *radare_argv[] = {
"l",
"L?", "L", "L-", "Ll", "LL", "La", "Lc", "Ld", "Lh", "Li", "Lo",
"m?", "m", "m*", "ml", "m-", "md", "mf?", "mf", "mg", "mo", "mi", "mp", "ms", "my",
"o?", "o", "o-", "o--", "o+", "oa", "oa-", "oq", "o*", "o.", "o=",
"o?", "o", "o-", "o--", "o+", "oe", "oa", "oa-", "oq", "o*", "o.", "o=",
"ob?", "ob", "ob*", "obo", "oba", "obf", "obj", "obr", "ob-", "ob-*",
"oc", "of", "oi", "oj", "oL", "om", "on",
"oo?", "oo", "oo+", "oob", "ood", "oom", "oon", "oon+", "oonn", "oonn+",
@ -2749,7 +2749,7 @@ static void __init_autocomplete_default(RCore* core) {
};
const char *files[] = {
".", "..", ".*", "/F", "/m", "!", "!!", "#!c", "#!v", "#!cpipe", "#!qjs", "#!tiny", "#!vala", "v.",
"#!rust", "#!zig", "#!pipe", "#!python", "aeli", "arp", "arpg", "dmd", "drp", "drpg", "o",
"#!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",
"/m", "zos", "zfd", "zfs", "zfz", "cat", "wta", "wtf", "wxf", "dml", "dd", "dd+",