diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-25 21:29:16 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-25 21:29:16 +0200 |
| commit | a701845a2751a3a260e9b3cc3b24e900eeb93391 (patch) | |
| tree | 4645b31e86ed71ef6001d0e5327106c454d6ac8c /internal | |
| parent | 9bee0ec4c3dd232d8e3957eb3d4b27cca4a8414c (diff) | |
Rename calculator package to perc
Renamed internal/calculator directory to internal/perc, updated package name from 'calculator' to 'perc', and updated all import references.
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/perc/perc.go (renamed from internal/calculator/calculator.go) | 8 | ||||
| -rw-r--r-- | internal/perc/perc_test.go (renamed from internal/calculator/calculator_test.go) | 2 | ||||
| -rw-r--r-- | internal/repl/handlers.go | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/internal/calculator/calculator.go b/internal/perc/perc.go index ccad360..9921ce4 100644 --- a/internal/calculator/calculator.go +++ b/internal/perc/perc.go @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // Copyright (c) 2026 Paul Buetow -package calculator +package perc import ( "fmt" @@ -100,10 +100,10 @@ func Parse(input string) (string, error) { return calc.Format(), nil } if err != nil { - return "", fmt.Errorf("calculator: unable to parse input %q: %w", input, err) + return "", fmt.Errorf("perc: unable to parse input %q: %w", input, err) } - return "", fmt.Errorf("calculator: unable to parse input %q: unknown error", input) + return "", fmt.Errorf("perc: unable to parse input %q: unknown error", input) } // ParseCalculation parses a percentage calculation input string and returns the Calculation object. @@ -128,7 +128,7 @@ func ParseCalculation(input string) (*Calculation, error) { return nil, err } - return nil, fmt.Errorf("calculator: unable to parse input %q. See usage for examples", input) + return nil, fmt.Errorf("perc: unable to parse input %q. See usage for examples", input) } // parseXPercentOfY calculates "X% of Y" and returns a Calculation. diff --git a/internal/calculator/calculator_test.go b/internal/perc/perc_test.go index c8f216b..d96fabb 100644 --- a/internal/calculator/calculator_test.go +++ b/internal/perc/perc_test.go @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // Copyright (c) 2026 Paul Buetow -package calculator +package perc import ( "strings" diff --git a/internal/repl/handlers.go b/internal/repl/handlers.go index f68e926..2cf62c4 100644 --- a/internal/repl/handlers.go +++ b/internal/repl/handlers.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "codeberg.org/snonux/perc/internal/calculator" + "codeberg.org/snonux/perc/internal/perc" "codeberg.org/snonux/perc/internal/rpn" ) @@ -224,7 +224,7 @@ type PercentageHandler struct { // Returns: (output string, handled bool, err error) func (h *PercentageHandler) Handle(repl *REPL, input string) (output string, handled bool, err error) { // Run the percentage calculation - result, err := calculator.Parse(input) + result, err := perc.Parse(input) if err != nil { // Not a percentage expression, pass to next handler return h.Next(repl, input) |
