Reading note
In this section, you will be responsible for filling out the rest of the read
command. Now, the read
command does have an else-if block to find in app.js
where we call getNote
:
} else if (command === 'read') { notes.getNote(argv.title);
getNote
is defined over inside notes.js
, even though currently it just prints out some dummy text:
var getNote = (title) => { console.log('Getting note', title); };
What you'll need to do in this section is wire up both of these functions.
First up, you will need to do something with the return value from getNote
. Our getNote
function will return the note object if it finds it. If it doesn't, it will return undefined just like we do for addNote
discussed in the section Adding and saving note, in the previous chapter.
After you store that value, you'll do some printing using console.log
, similar to what we have here:
if (command === 'add') { var note = notes.addNote(argv.title, argv.body); if (note) { console.log('Note created'); console...