diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-24 18:29:08 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-24 18:29:08 +0300 |
| commit | ddef6c380732097bf7813af6ee6e181877c80b56 (patch) | |
| tree | b6e8be56857a05c9852fcc364f068559d112fa15 | |
| parent | 4fdc92269e36c695fa96f91dd62b0715b4583587 (diff) | |
fix(rpn): use correct subcommand name in metric error messages (task ak)
| -rw-r--r-- | internal/rpn/rpn_parse.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/rpn/rpn_parse.go b/internal/rpn/rpn_parse.go index 51c64c7..2c37d3a 100644 --- a/internal/rpn/rpn_parse.go +++ b/internal/rpn/rpn_parse.go @@ -504,9 +504,9 @@ func (r *RPN) handleMetricCommand(stack *Stack, tokens []string, i int) (string, } return result, true, nil case "binary": - return r.handleMetricPrefix(tokens, i, IEC, "IEC") + return r.handleMetricPrefix(tokens, i, IEC, "IEC", "binary") case "decimal": - return r.handleMetricPrefix(tokens, i, SI, "SI") + return r.handleMetricPrefix(tokens, i, SI, "SI", "decimal") case "compatible": result, err := r.ops.MetricCompatible(stack) if err != nil { @@ -602,12 +602,12 @@ func (r *RPN) handleInlineAssignment(stack *Stack, name, op string) (string, boo } // handleMetricPrefix handles metric binary/decimal prefix mode switching. -func (r *RPN) handleMetricPrefix(tokens []string, i int, mode PrefixMode, label string) (string, bool, error) { +func (r *RPN) handleMetricPrefix(tokens []string, i int, mode PrefixMode, modeLabel, subcmd string) (string, bool, error) { if i+2 < len(tokens) && tokens[i+2] == "set" { r.ops.SetPrefixMode(mode) - return fmt.Sprintf("prefix mode: %s", label), true, nil + return fmt.Sprintf("prefix mode: %s", modeLabel), true, nil } - return "", true, fmt.Errorf("rpn: metric %s: use 'metric %s set'", label, label) + return "", true, fmt.Errorf("rpn: metric %s: use 'metric %s set'", subcmd, subcmd) } // handleCustomDefine handles the 'custom define <name> <factor> <category>' subcommand. |
