Skip to content

Add edit command to notes CLI - #158

Open
volodymyrlp wants to merge 7 commits into
mate-academy:mainfrom
volodymyrlp:review-me
Open

Add edit command to notes CLI#158
volodymyrlp wants to merge 7 commits into
mate-academy:mainfrom
volodymyrlp:review-me

Conversation

@volodymyrlp

Copy link
Copy Markdown

What

Adds an edit <id> <text> command to the notes CLI.

  • lib/store.js: new edit(id, text) — looks up a note by id and replaces its text
  • notes.js: new case "edit" wired to store.edit, plus updated help text
  • main has been merged in to resolve the lib/store.js add/add conflict

Try it

node notes.js add "buy milk"
node notes.js edit 1 "buy oat milk"
node notes.js list

Review note

This branch carries a deliberately planted bug for the Lesson 4 exercise: edit() does not check that the looked-up note exists, so node notes.js edit <unknown-id> ... throws TypeError: Cannot set properties of undefined. remove() right above it handles the missing-id case. Left in place intentionally — see the review comments on the fork PR (#1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants