diff options
Diffstat (limited to 'src/note_list.c')
-rw-r--r-- | src/note_list.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/note_list.c b/src/note_list.c index 2566b59..6ddb47a 100644 --- a/src/note_list.c +++ b/src/note_list.c @@ -261,16 +261,23 @@ int note_list_cat_note(note_list_t* list, char* note_name) { * * @return int Exit code (1 = error, 0 = success) */ -// int note_list::rm( string note_name ) { -// int id = find_note_id( note_name ); -// if( id == -1 ) { -// cout << "Note \"" << note_name << "\" does not exist." << endl; -// return 1; -// } else { -// notes[id].rm(); -// } -// return 0; -// } +int note_list_rm_note(note_list_t* list, char* note_name) { + int id = note_list_get_note_id(list, note_name); + if(id == -1) { + printf("Error: There is no note matching \"%s\".\n", note_name); + return 1; + } else { + char note_path[256] = ""; + strcpy(note_path, list->path); + strcat(note_path, "/"); + strcat(note_path, list->names[id]); + + note_t note; + note_new(¬e, note_path); + return note_rm(¬e); + } + return 0; +} /** * TODO |