Skip to content

Add count command to show how many notes exist - #306

Open
hernandezggg wants to merge 1 commit into
mate-academy:mainfrom
hernandezggg:add-count-command
Open

hernandezggg wants to merge 1 commit into
mate-academy:mainfrom
hernandezggg:add-count-command

Conversation

@hernandezggg

Copy link
Copy Markdown

What changed

  • Added store.count() in lib/store.js, which returns the number of saved notes.
  • Added a count command to notes.js that prints You have N notes. (You have 1 note. for a single note).
  • Added count to the usage line shown for unknown commands and to the command list in README.md.

Why

There was no quick way to see how many notes you have without running list and counting the lines by hand. count gives that answer in one command.

How it was tested

  • npm test passes (3/3) before and after the change.
  • Ran node notes.js count manually with 0, 1 and 2 notes and checked the output for each case.

🤖 Generated with Claude Code

Adds store.count() and a `count` CLI command that prints
"You have N notes." (singular for one note), and documents it
in the README command list.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Your implementation correctly adds the count command as required. Both lib/store.js and notes.js have been updated with the new functionality, including proper singular/plural handling ("You have 1 note." vs "You have X notes."). All five required commands (add, list, search, delete, count) are implemented and the help text is updated. The code follows existing patterns in the codebase and integrates seamlessly. The PR was properly created from a new branch with an appropriate description. Your solution meets all task requirements and is ready to merge.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example ↩

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