summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-20 22:55:39 +0200
committerPaul Buetow <paul@buetow.org>2026-03-20 22:55:39 +0200
commit591f12f6c2eafa0d565ed85867d03e92f28406b5 (patch)
treed557f148520c708bfb4da75b82230eba56cbf907
parenta90f7eb6a1c538972eaf52898dd65fa76f26b1d3 (diff)
internal/calculator/internal/repl: Add missing comments for exported functions
- Added Parse() comment in calculator.go - Updated Commands() comment in repl/commands.go to be more descriptive
-rw-r--r--internal/calculator/calculator.go2
-rw-r--r--internal/repl/commands.go2
2 files changed, 3 insertions, 1 deletions
diff --git a/internal/calculator/calculator.go b/internal/calculator/calculator.go
index fdca99b..b876a48 100644
--- a/internal/calculator/calculator.go
+++ b/internal/calculator/calculator.go
@@ -7,6 +7,8 @@ import (
"strings"
)
+// Parse parses a percentage calculation input string and returns the result.
+// It handles formats like "20% of 150", "30 is what % of 150", and "30 is 20% of what".
func Parse(input string) (string, error) {
input = strings.ToLower(strings.TrimSpace(input))
input = strings.ReplaceAll(input, "what is ", "")
diff --git a/internal/repl/commands.go b/internal/repl/commands.go
index 656f670..d03672e 100644
--- a/internal/repl/commands.go
+++ b/internal/repl/commands.go
@@ -8,7 +8,7 @@ import (
// builtinCommands defines the built-in REPL commands
var builtinCommands = []string{"help", "clear", "quit", "exit", "rpn", "calc"}
-// Commands returns the list of built-in command names
+// Commands returns the list of built-in command names supported by the REPL.
func Commands() []string {
return builtinCommands
}