Repository navigation
Add count command to print how many notes you have - #297
Open
Lemonch1ks wants to merge 1 commit into
Open
Lemonch1ks wants to merge 1 commit into
Lemonch1ks wants to merge 1 commit into
Conversation
`node notes.js count` prints e.g. "You have 3 notes." (singular for one note, "You have no notes." when empty). Message formatting lives in lib/format.js so it can be unit-tested without touching notes.json. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Adds a
countcommand to the notes CLI:notes.js— newcountcase;countadded to the help line.lib/format.js(new) —countMessage(n)builds the text: plural for many,You have 1 note.for one,You have no notes.for zero.tests/format.test.js(new) — 3 tests covering 0, 1 and many.README.md— documents the new command.Why
Lesson 3 task: a small, self-contained change to practise branching and pull requests. Quickly seeing how many notes you have is handy without listing them all.
How it was checked
npm test— 6/6 pass (3 existing + 3 new).You have no notes., after adding two notes →You have 2 notes.For the reviewer
lib/format.jsso it can be unit-tested without reading/writingnotes.json(existing tests follow the same pure-function approach). Happy to fold it intostore.jsif preferred.You have no notes.rather thanYou have 0 notes.— a wording choice worth a quick look.🤖 Generated with Claude Code