diff options
Diffstat (limited to 'internal/rpn/operations_stack.go')
| -rw-r--r-- | internal/rpn/operations_stack.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/internal/rpn/operations_stack.go b/internal/rpn/operations_stack.go index 2505e37..e8752a6 100644 --- a/internal/rpn/operations_stack.go +++ b/internal/rpn/operations_stack.go @@ -52,6 +52,8 @@ func (o *Operations) Pop(stack *Stack) error { } // Show returns the current stack as a formatted string using the Number interface. +// Numbers with non-Cool metrics display with the metric suffix (e.g., "100Mbps"). +// Cool numbers display as plain numbers. Booleans show as "true"/"false". func (o *Operations) Show(stack *Stack) (string, error) { if stack.Len() == 0 { return "Stack is empty", nil @@ -63,10 +65,13 @@ func (o *Operations) Show(stack *Stack) (string, error) { if i > 0 { result += " " } - // Use val.String() to format values correctly: - // - Boolean values show as "true"/"false" - // - Number values show with appropriate precision - result += val.String() + // Append metric suffix for non-Cool metrics + m := val.Metric() + if m != nil && m.Category != Universal { + result += val.String() + m.Name + } else { + result += val.String() + } } return result, nil } |
