From ec4d86f7276e6a8b051932a5dc984ebd6c4915f0 Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Tue, 5 Dec 2023 20:01:32 +0100 Subject: [PATCH] added a couple of shortcuts --- calc.go | 16 ++++++++++++---- command.go | 13 +++++++++++-- rpn.go | 11 +++++++++++ rpn.pod | 11 +++++++++++ 4 files changed, 45 insertions(+), 6 deletions(-) diff --git a/calc.go b/calc.go index 398a3ab..d817844 100644 --- a/calc.go +++ b/calc.go @@ -121,19 +121,27 @@ func (c *Calc) GetCompleteCustomFuncalls() func(string) []string { } for command := range c.SettingsCommands { - completions = append(completions, command) + if len(command) > 1 { + completions = append(completions, command) + } } for command := range c.ShowCommands { - completions = append(completions, command) + if len(command) > 1 { + completions = append(completions, command) + } } for command := range c.StackCommands { - completions = append(completions, command) + if len(command) > 1 { + completions = append(completions, command) + } } for command := range c.Commands { - completions = append(completions, command) + if len(command) > 1 { + completions = append(completions, command) + } } return completions diff --git a/command.go b/command.go index 0a43fdb..c460200 100644 --- a/command.go +++ b/command.go @@ -305,6 +305,15 @@ func (c *Calc) SetCommands() { // aliases c.Commands["quit"] = c.Commands["exit"] - c.SettingsCommands["undebug"] = c.SettingsCommands["nodebug"] - c.SettingsCommands["show"] = c.SettingsCommands["showstack"] + + c.SettingsCommands["d"] = c.SettingsCommands["debug"] + c.SettingsCommands["b"] = c.SettingsCommands["batch"] + c.SettingsCommands["s"] = c.SettingsCommands["showstack"] + + c.ShowCommands["h"] = c.ShowCommands["history"] + c.ShowCommands["p"] = c.ShowCommands["dump"] + c.ShowCommands["v"] = c.ShowCommands["vars"] + + c.StackCommands["c"] = c.StackCommands["clear"] + c.StackCommands["u"] = c.StackCommands["undo"] } diff --git a/rpn.go b/rpn.go index 89bebf6..b5df4b1 100644 --- a/rpn.go +++ b/rpn.go @@ -198,6 +198,17 @@ DESCRIPTION Refer to https://pkg.go.dev/math for details about those functions. + There are also a number of shortcuts for some commands available: + + d debug + b batch + s showstack + h history + p dump (aka print) + v vars + c clear + u undo + INTERACTIVE REPL While you can use rpn in the command-line, the best experience you'll have is the interactive repl (read eval print loop). Just execute "rpn" diff --git a/rpn.pod b/rpn.pod index 529a107..5a7359a 100644 --- a/rpn.pod +++ b/rpn.pod @@ -213,6 +213,17 @@ Register variables: Refer to https://pkg.go.dev/math for details about those functions. +There are also a number of shortcuts for some commands available: + + d debug + b batch + s showstack + h history + p dump (aka print) + v vars + c clear + u undo + =head1 INTERACTIVE REPL While you can use rpn in the command-line, the best experience you'll