fix dev subcmd editor
This commit is contained in:
parent
1a764d6a14
commit
408de3a337
1 changed files with 8 additions and 11 deletions
|
|
@ -84,19 +84,16 @@ subcmds_dev(void *, int argc, char *argv[])
|
||||||
add(cwd);
|
add(cwd);
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[1], "edit") == 0) {
|
} else if (strcmp(argv[1], "edit") == 0) {
|
||||||
wpath = calloc(strlen(conf_state_path()) + 4, sizeof(char));
|
|
||||||
strcpy(wpath, conf_state_path());
|
|
||||||
strcat(wpath, "dev");
|
|
||||||
|
|
||||||
editor = getenv("EDITOR");
|
editor = getenv("EDITOR");
|
||||||
puts(getenv("XDG_CONFIG_DIR"));
|
if (!editor) {
|
||||||
return;
|
return;
|
||||||
if (editor) {
|
|
||||||
execvp(editor, (char *[]){ editor, wpath, NULL });
|
|
||||||
goto free_stuff;
|
|
||||||
}
|
}
|
||||||
printf("Failed to open editor\n");
|
wpath = calloc(strlen(conf_state_path()) + strlen(editor) + 5, sizeof(char));
|
||||||
free_stuff:
|
strcat(wpath, editor);
|
||||||
|
strcat(wpath, " ");
|
||||||
|
strcat(wpath, conf_state_path());
|
||||||
|
strcat(wpath, "dev");
|
||||||
|
system(wpath);
|
||||||
free(wpath);
|
free(wpath);
|
||||||
} else if (strcmp(argv[1], "help") == 0 || strcmp(argv[1], "h") == 0) {
|
} else if (strcmp(argv[1], "help") == 0 || strcmp(argv[1], "h") == 0) {
|
||||||
printf("Help text\n");
|
printf("Help text\n");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue