2015-01-21 22:47:49 +00:00
|
|
|
/* radare - LGPL - Copyright 2009-2015 - pancake */
|
2013-12-28 01:34:15 +00:00
|
|
|
|
2012-02-27 01:40:27 +00:00
|
|
|
static int cmd_project(void *data, const char *input) {
|
|
|
|
RCore *core = (RCore *)data;
|
2013-12-28 01:34:15 +00:00
|
|
|
const char *file, *arg = input+1;
|
2012-02-27 01:40:27 +00:00
|
|
|
char *str = strdup (r_config_get (core->config, "file.project"));
|
|
|
|
if (*arg==' ') arg++;
|
2013-12-28 01:34:15 +00:00
|
|
|
file = input[1]?arg:str;
|
2012-02-27 01:40:27 +00:00
|
|
|
switch (input[0]) {
|
2013-12-28 01:34:15 +00:00
|
|
|
case 'o':
|
|
|
|
// if (r_file_is_regular (file))
|
|
|
|
r_core_project_open (core, file);
|
|
|
|
break;
|
2015-01-21 22:47:49 +00:00
|
|
|
case 'l':
|
|
|
|
r_core_project_list (core, input[1]);
|
|
|
|
break;
|
2015-01-21 23:30:19 +00:00
|
|
|
case 'd':
|
|
|
|
r_core_project_delete (core, file);
|
|
|
|
break;
|
2013-12-28 01:34:15 +00:00
|
|
|
case 's':
|
2015-01-21 23:30:19 +00:00
|
|
|
if (r_core_project_save (core, file)) {
|
|
|
|
r_config_set (core->config, "file.project", file);
|
|
|
|
r_cons_printf ("%s\n", file);
|
|
|
|
}
|
2013-12-28 01:34:15 +00:00
|
|
|
break;
|
|
|
|
case 'i':
|
|
|
|
// if (r_file_is_regular (file))
|
|
|
|
free (r_core_project_info (core, file));
|
|
|
|
break;
|
2014-06-28 14:35:15 +00:00
|
|
|
default: {
|
|
|
|
const char* help_msg[] = {
|
|
|
|
"Usage:", "P[?osi] [file]", "Project management",
|
|
|
|
"Po", " [file]", "open project",
|
|
|
|
"Ps", " [file]", "save project",
|
2015-01-21 23:30:19 +00:00
|
|
|
"Pd", " [file]", "delete project",
|
2014-06-28 14:35:15 +00:00
|
|
|
"Pi", " [file]", "show project information",
|
2015-01-21 22:47:49 +00:00
|
|
|
"Pl", "", "list all projects",
|
2014-06-28 14:35:15 +00:00
|
|
|
"NOTE:", "", "See 'e file.project'",
|
|
|
|
"NOTE:", "", "project files are stored in ~/.config/radare2/projects",
|
|
|
|
NULL};
|
|
|
|
r_core_cmd_help (core, help_msg);
|
|
|
|
}
|
2012-02-27 01:40:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
free (str);
|
|
|
|
return R_TRUE;
|
|
|
|
}
|