mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-30 08:30:53 +00:00
Add scr.prompt.prj to show project name ##projects
This commit is contained in:
parent
9b632bc9d7
commit
b8216a0e62
@ -4364,6 +4364,7 @@ R_API int r_core_config_init(RCore *core) {
|
||||
SETPREF ("scr.prompt.tabhelp", "true", "show command help when pressing the TAB key");
|
||||
SETCB ("scr.prompt.mode", "false", &cb_scr_prompt_mode, "set prompt color based on vi mode");
|
||||
SETBPREF ("scr.prompt.file", "false", "show user prompt file (used by r2 -q)");
|
||||
SETBPREF ("scr.prompt.prj", "false", "show currently used project in prompt");
|
||||
SETBPREF ("scr.prompt.flag", "false", "show flag name in the prompt");
|
||||
SETBPREF ("scr.prompt.sect", "false", "show section name in the prompt");
|
||||
SETBPREF ("scr.tts", "false", "use tts if available by a command (see ic)");
|
||||
|
@ -84,7 +84,7 @@ static void r_core_project_zip_export(RCore *core, const char *prjname, const ch
|
||||
char *zipfile = r_str_newf ("%s/%s.zrp", cwd, prj_name);
|
||||
r_file_rm (zipfile);
|
||||
// XXX use the ZIP api instead!
|
||||
r_sys_cmdf ("zip -r %s %s", outzip? outzip: zipfile, prj_name);
|
||||
r_sys_cmdf ("zip -r %s/%s %s", cwd, outzip? outzip: zipfile, prj_name);
|
||||
free (zipfile);
|
||||
} else {
|
||||
R_LOG_WARN ("Command injection attempt?");
|
||||
@ -102,10 +102,10 @@ static void cmd_Pz(RCore *core, const char *cmd) {
|
||||
arg++;
|
||||
}
|
||||
switch (*cmd) {
|
||||
case 'i':
|
||||
case 'i': // "Pzi"
|
||||
r_core_project_zip_import (core, arg);
|
||||
break;
|
||||
case 'e':
|
||||
case 'e': // "Pze"
|
||||
case ' ':
|
||||
r_core_project_zip_export (core, NULL, arg);
|
||||
break;
|
||||
@ -194,7 +194,7 @@ static int cmd_project(void *data, const char *input) {
|
||||
}
|
||||
break;
|
||||
case 'z': // "Pz"
|
||||
cmd_Pz (core, input + 1);
|
||||
cmd_Pz (core, r_str_trim_head_ro (input + 1));
|
||||
break;
|
||||
case '+': // "P+"
|
||||
// xxx
|
||||
|
@ -3574,10 +3574,14 @@ static void set_prompt(RCore *r) {
|
||||
r_core_cmd (r, cmdprompt, 0);
|
||||
}
|
||||
|
||||
if (r_config_get_b (r->config, "scr.prompt.file")) {
|
||||
if (r_config_get_b (r->config, "scr.prompt.prj")) {
|
||||
free (filename);
|
||||
const char *pn = r_config_get (r->config, "prj.name");
|
||||
filename = r_str_newf ("<%s>", pn);
|
||||
} else if (r_config_get_b (r->config, "scr.prompt.file")) {
|
||||
free (filename);
|
||||
const char *fn = r->io->desc ? r_file_basename (r->io->desc->name) : "";
|
||||
filename = r_str_newf ("\"%s\"", fn);
|
||||
filename = r_str_newf ("<%s>", fn);
|
||||
}
|
||||
if (r->cmdremote) {
|
||||
char *s = r_core_cmd_str (r, "s");
|
||||
|
Loading…
Reference in New Issue
Block a user