1
0
Fork 0
This commit is contained in:
Jason Williams 2019-08-11 13:17:40 -06:00
parent 63e639fab3
commit 15a11f8ac9
3 changed files with 13 additions and 3 deletions

View File

@ -47,7 +47,7 @@ yargs.command({
command: 'list',
describe: 'List notes',
handler() {
console.log('Listing out all notes');
notes.listNotes();
}
});

View File

@ -34,6 +34,15 @@ const removeNote = (title) => {
}
}
const listNotes = () => {
const notes = loadNotes();
console.log(chalk.cyan.underline('Your notes:'));
notes.forEach((note) => {
console.log(note.title);
});
}
const saveNotes = (notes) => {
const dataJSON = JSON.stringify(notes);
fs.writeFileSync('notes.json', dataJSON);
@ -52,5 +61,6 @@ const loadNotes = () => {
module.exports = {
getNotes: getNotes,
addNote: addNote,
removeNote: removeNote
removeNote: removeNote,
listNotes: listNotes
}

View File

@ -1 +1 @@
[{"title":"List","body":"Sweater, Pants"}]
[{"title":"List","body":"Sweater, Pants"},{"title":"Course Ideas","body":""}]