feat: add a clear command to reset the in-session history

Closed Beginner friendly
#23 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
cli

Research direction

Start in SimpleCalc/Program.cs, where the history and exit command checks run before the operator switch, and read RememberResult and ShowHistory to see how historyCount and historyNext are maintained. Add a case-insensitive clear command that resets the buffer state and prints a confirmation, then list it in the README command section. Done means that running two calculations, history, clear, and history shows two lines and then an empty list, and a smoke test covers that sequence.

Written by the indexing model from the issue text.

Description

The only in-session commands are history and exit (Program.cs checks these before the operator switch). The 3-slot history ring buffer (#19) keeps growing stale results for the life of the session with no way to clear it — once a user has run a few unrelated calculations, history shows a mix they cannot reset without restarting the process.

Evidence

  • grep -n '"history"\|"exit"' SimpleCalc/Program.cs → the two only command checks; no clear/reset anywhere.
  • RememberResult/ShowHistory manage historyCount/historyNext but nothing zeroes the buffer.

Suggested scope

  • Recognise clear (case-insensitive, like the other commands): reset historyCount = 0, historyNext = 0, blank the slots, and print confirmation.
  • Document in the README command list; add a smoke test: run two calcs, history (2 lines), clear, history (empty).
Dominant language
C#
Stars
0
Forks
0
Avg merge
1h 12m
Merged PRs (30d)
4

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from billyx86/CSharp-SimpleCalculator

All issues in billyx86/CSharp-SimpleCalculator

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.