mirror of
https://codeberg.org/scip/rpnc.git
synced 2025-12-17 12:31:04 +01:00
Compare commits
3 Commits
fix/dont-s
...
feature/ed
| Author | SHA1 | Date | |
|---|---|---|---|
| ed7ab15a1e | |||
| 91fac6d160 | |||
| a33a76bb06 |
10
calc.go
10
calc.go
@@ -121,28 +121,20 @@ func (c *Calc) GetCompleteCustomFuncalls() func(string) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for command := range c.SettingsCommands {
|
for command := range c.SettingsCommands {
|
||||||
if len(command) > 1 {
|
|
||||||
completions = append(completions, command)
|
completions = append(completions, command)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for command := range c.ShowCommands {
|
for command := range c.ShowCommands {
|
||||||
if len(command) > 1 {
|
|
||||||
completions = append(completions, command)
|
completions = append(completions, command)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for command := range c.StackCommands {
|
for command := range c.StackCommands {
|
||||||
if len(command) > 1 {
|
|
||||||
completions = append(completions, command)
|
completions = append(completions, command)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for command := range c.Commands {
|
for command := range c.Commands {
|
||||||
if len(command) > 1 {
|
|
||||||
completions = append(completions, command)
|
completions = append(completions, command)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return completions
|
return completions
|
||||||
}
|
}
|
||||||
@@ -520,10 +512,8 @@ func sortcommands(hash Commands) []string {
|
|||||||
keys := make([]string, 0, len(hash))
|
keys := make([]string, 0, len(hash))
|
||||||
|
|
||||||
for key := range hash {
|
for key := range hash {
|
||||||
if len(key) > 1 {
|
|
||||||
keys = append(keys, key)
|
keys = append(keys, key)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
sort.Strings(keys)
|
sort.Strings(keys)
|
||||||
|
|
||||||
|
|||||||
13
command.go
13
command.go
@@ -305,15 +305,6 @@ func (c *Calc) SetCommands() {
|
|||||||
|
|
||||||
// aliases
|
// aliases
|
||||||
c.Commands["quit"] = c.Commands["exit"]
|
c.Commands["quit"] = c.Commands["exit"]
|
||||||
|
c.SettingsCommands["undebug"] = c.SettingsCommands["nodebug"]
|
||||||
c.SettingsCommands["d"] = c.SettingsCommands["debug"]
|
c.SettingsCommands["show"] = c.SettingsCommands["showstack"]
|
||||||
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"]
|
|
||||||
}
|
}
|
||||||
|
|||||||
2
main.go
2
main.go
@@ -30,7 +30,7 @@ import (
|
|||||||
lua "github.com/yuin/gopher-lua"
|
lua "github.com/yuin/gopher-lua"
|
||||||
)
|
)
|
||||||
|
|
||||||
const VERSION string = "2.0.12"
|
const VERSION string = "2.0.11"
|
||||||
|
|
||||||
const Usage string = `This is rpn, a reverse polish notation calculator cli.
|
const Usage string = `This is rpn, a reverse polish notation calculator cli.
|
||||||
|
|
||||||
|
|||||||
39
rpn.go
39
rpn.go
@@ -178,27 +178,17 @@ DESCRIPTION
|
|||||||
[no]debug toggle debug output (nodebug turns it off)
|
[no]debug toggle debug output (nodebug turns it off)
|
||||||
[no]showstack show the last 5 items of the stack (noshowtack turns it off)
|
[no]showstack show the last 5 items of the stack (noshowtack turns it off)
|
||||||
|
|
||||||
Show commands:
|
Show commands: dump display the stack contents hex show last stack item
|
||||||
|
in hex form (converted to int) history display calculation history vars
|
||||||
|
show list of variables
|
||||||
|
|
||||||
dump display the stack contents
|
Stack manipulation commands: clear clear the whole stack shift remove
|
||||||
hex show last stack item in hex form (converted to int)
|
the last element of the stack reverse reverse the stack elements swap
|
||||||
history display calculation history
|
exchange the last two stack elements dup duplicate last stack item undo
|
||||||
vars show list of variables
|
undo last operation edit edit the stack interactively using vi or
|
||||||
|
$EDITOR
|
||||||
|
|
||||||
Stack manipulation commands:
|
Other commands: help|? show this message manual show manual
|
||||||
|
|
||||||
clear clear the whole stack
|
|
||||||
shift remove the last element of the stack
|
|
||||||
reverse reverse the stack elements
|
|
||||||
swap exchange the last two stack elements
|
|
||||||
dup duplicate last stack item
|
|
||||||
undo undo last operation
|
|
||||||
edit edit the stack interactively using vi or $EDITOR
|
|
||||||
|
|
||||||
Other commands:
|
|
||||||
|
|
||||||
help|? show this message
|
|
||||||
manual show manual
|
|
||||||
quit|exit|c-d|c-c exit program
|
quit|exit|c-d|c-c exit program
|
||||||
|
|
||||||
Register variables:
|
Register variables:
|
||||||
@@ -208,17 +198,6 @@ DESCRIPTION
|
|||||||
|
|
||||||
Refer to https://pkg.go.dev/math for details about those functions.
|
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
|
INTERACTIVE REPL
|
||||||
While you can use rpn in the command-line, the best experience you'll
|
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"
|
have is the interactive repl (read eval print loop). Just execute "rpn"
|
||||||
|
|||||||
14
rpn.pod
14
rpn.pod
@@ -186,14 +186,12 @@ Configuration Commands:
|
|||||||
[no]showstack show the last 5 items of the stack (noshowtack turns it off)
|
[no]showstack show the last 5 items of the stack (noshowtack turns it off)
|
||||||
|
|
||||||
Show commands:
|
Show commands:
|
||||||
|
|
||||||
dump display the stack contents
|
dump display the stack contents
|
||||||
hex show last stack item in hex form (converted to int)
|
hex show last stack item in hex form (converted to int)
|
||||||
history display calculation history
|
history display calculation history
|
||||||
vars show list of variables
|
vars show list of variables
|
||||||
|
|
||||||
Stack manipulation commands:
|
Stack manipulation commands:
|
||||||
|
|
||||||
clear clear the whole stack
|
clear clear the whole stack
|
||||||
shift remove the last element of the stack
|
shift remove the last element of the stack
|
||||||
reverse reverse the stack elements
|
reverse reverse the stack elements
|
||||||
@@ -203,7 +201,6 @@ Stack manipulation commands:
|
|||||||
edit edit the stack interactively using vi or $EDITOR
|
edit edit the stack interactively using vi or $EDITOR
|
||||||
|
|
||||||
Other commands:
|
Other commands:
|
||||||
|
|
||||||
help|? show this message
|
help|? show this message
|
||||||
manual show manual
|
manual show manual
|
||||||
quit|exit|c-d|c-c exit program
|
quit|exit|c-d|c-c exit program
|
||||||
@@ -216,17 +213,6 @@ Register variables:
|
|||||||
|
|
||||||
Refer to https://pkg.go.dev/math for details about those functions.
|
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
|
=head1 INTERACTIVE REPL
|
||||||
|
|
||||||
While you can use rpn in the command-line, the best experience you'll
|
While you can use rpn in the command-line, the best experience you'll
|
||||||
|
|||||||
Reference in New Issue
Block a user