diff options
author | Aaron Ball <nullspoon@iohq.net> | 2015-02-24 12:20:56 -0700 |
---|---|---|
committer | Aaron Ball <nullspoon@iohq.net> | 2015-02-24 12:20:56 -0700 |
commit | 3bbfd0f3882a3832fb2affaa6d2a8aff2fedc6ba (patch) | |
tree | 7ea7f52f26f6765b118e7adba3248086321690fd | |
parent | ba5782026e73073e2a76bd628e9596338fe5e9c2 (diff) | |
download | noteless-3bbfd0f3882a3832fb2affaa6d2a8aff2fedc6ba.tar.gz noteless-3bbfd0f3882a3832fb2affaa6d2a8aff2fedc6ba.tar.xz |
Added support for "cmd not found searching notes"
When a command is given to noteless and it doesn't match any commands, a fuzzy
search through the note names is now performed. If one of the note names
matches the "unknown command" argument, the note is opened for editing. This
is effectively the default behavior (edit) if a command is not specified.
-rw-r--r-- | src/main.c | 6 | ||||
-rw-r--r-- | src/note_list.c | 1 |
2 files changed, 3 insertions, 4 deletions
@@ -187,9 +187,9 @@ int main(int argc, char* argv[]) { // return cat_note( list, name ); } else if(strcmp(argv[1], "help") == 0) { get_help(); - // } else if( list.find_note_id( arg ) != -1 ) { - // // Try to open the note if it exists - // return list.edit( editor, arg ); + } else if(note_list_get_note_id(&list, argv[1]) != -1 ) { + // Try to open the note if it exists + return note_list_edit(&list, editor, argv[1]); } else { printf("Error: Unknown command or note name '%s'.\n", argv[1]); return 1; diff --git a/src/note_list.c b/src/note_list.c index 638d631..bcfd1e0 100644 --- a/src/note_list.c +++ b/src/note_list.c @@ -178,7 +178,6 @@ int note_list_edit(note_list_t* list, char* editor, char* note_name) { strcat(path, list->names[id]); strcat(path, "."); strcat(path, list->extension); - printf("%s\n", path); note_t note; note_new(¬e, path); |