summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/main.c b/src/main.c
index 393ade8..dea8ba6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -34,7 +34,7 @@ void get_help() {
" cat <note> Outputs the specified note's contents verbatim.\n"
" new <note> Creates the specified note and opens for editing.\n"
" edit <note> Opens the specified note for editing.\n"
- " find <term> Performs a case-insensitive search of all notes for the\n"
+ //" find <term> Performs a case-insensitive search of all notes for the\n"
" rm <note> Deletes the specified note.\n"
" given search term.\n"
" help Displays this help text\n"
@@ -178,11 +178,17 @@ int main(int argc, char* argv[]) {
return create_status;
}
} else if(strcmp(argv[1], "edit") == 0) {
- char* name = argv[2];
- return note_list_edit(&list, editor, name );
- // } else if( arg == "rm" ) {
- // string name = argv[i + 1];
- // return list.rm( name );
+ return note_list_edit(&list, editor, argv[2]);
+ } else if(strcmp(argv[1], "rm") == 0) {
+ int rm_status = note_list_rm_note(&list, argv[2]);
+ if(rm_status == 0) {
+ printf("Note matching \"%s\" deleted successfully\n", argv[2]);
+ } else if(rm_status == 1) {
+ printf("Error: There are no notes matching \"%s\".\n", argv[2]);
+ } else {
+ printf("Error: Failed deleting note matching \"%s\".\n", argv[2]);
+ }
+ return rm_status;
// } else if( arg == "find" ) {
// string term = argv[i + 1];
// return search_notes( list, term );

Generated by cgit