summaryrefslogtreecommitdiff
path: root/internal/repl/prompt.go
AgeCommit message (Collapse)Author
2026-04-11Multiple code-quality and feature improvementsPaul Buetow
- Task 31: Refactor repl tests to remove dependency on package-level singletons - Task 41: Introduce Calculator interface to decouple REPL from RPN engine - Task 61: Implement persistent variable store with Save/Load methods - Task 71: Add stack inspection (peek) command to REPL - Task 81: Expand constants library with additional mathematical constants - Task a1: Add session logging flag (--log) to gt CLI - Task 91: Integrate reverse history search (Ctrl+R) using readline This commit includes: - New: internal/repl/calculator.go - Calculator interface for RPN decoupling - New: internal/repl/completer.go - AutoCompleteAdapter for readline - Modified: internal/repl/repl.go - Uses readline instead of go-prompt - Modified: internal/rpn/variables.go - Added Save/Load for persistent state - Modified: internal/rpn/rpn_state.go - Added Stack() method - Modified: internal/rpn/constants.go - Added more mathematical constants - Modified: internal/repl/commands.go - Added 'stack' command - Modified: internal/repl/completer_test.go - Updated for readline API - Modified: internal/repl/repl_test.go - Updated for Calculator interface - Modified: internal/repl/concurrent_test.go - Updated for Calculator interface - Modified: internal/repl/handlers.go - Updated for Calculator interface - Modified: internal/rpn/variables_test.go - Added Save/Load tests - Modified: internal/rpn/constants_test.go - Added new constant tests - Modified: cmd/gt/main.go - Added --log flag support - Modified: Magefile.go - Symmetrized Install/Uninstall logic - Deleted: internal/repl/prompt.go - Replaced by readline integration - Added: STORY.md - Project history documentation
2026-03-25docs: Add SPDX license headers to all .go source filesPaul Buetow
- Added 'SPDX-License-Identifier: MIT' and 'Copyright (c) 2026 Paul Buetow' headers - Files updated: 24 .go files across cmd/gt/, internal/calculator/, internal/repl/, internal/rpn/ The MIT license from LICENSE file is reflected in all source files.
2026-03-25docs: Add comprehensive Go documentation for REPL functionsPaul Buetow
- Enhanced NewREPL documentation with detailed parameter descriptions - Enhanced RunREPL documentation clarifying it's a convenience wrapper - Improved executor documentation explaining backward compatibility and testing usage - Enhanced defaultExecutor documentation with input processing details and panic recovery - Enhanced defaultCompleter documentation with tab-completion behavior details - Enhanced defaultGetCommandDescription documentation with command description details - Improved TTYChecker methods (IsTTY, EnsureTTY) documentation - Improved SignalHandler.Start method documentation All exported and non-exported functions in the REPL package now have comprehensive documentation comments that describe their purpose, parameters, and return values.
2026-03-24feat: Add RPN mode, rational number support, and improve REPLPaul Buetow
- Add RPN (Reverse Polish Notation) calculator with stack-based operations - Support precise rational number calculations using *big.Rat - Implement chain of responsibility pattern for command handling - Add auto-completion for built-in commands - Add history persistence with configurable max entries - Support standard operators: +, -, *, /, ^, %, lg, log, ln - Support hyper operators: [+], [-], [*], [/], [^], [%], [lg], [log], [ln] - Support stack manipulation: dup, swap, pop, show - Support variable assignments and management - Add rat mode for switching between float64 and rational calculations - Refactor calculator to return Calculation struct with formatting - Add proper version support (v0.3.0) All changes follow Go best practices with comprehensive test coverage.