diff --git a/README.md b/README.md
index 81de2cb..d111d36 100644
--- a/README.md
+++ b/README.md
@@ -192,12 +192,23 @@ Simply add the value of the requested constant to the top of the stack / line1
## User Defined Functions
RPNCalc can record your commands and save them as a user defined function. You can then run this function on demand. So create your stack as you envision it being used in the future. Then enable recording, process the stack as you like, then stop the recording. Give a name to your user defined function and it will be saved. Then, you can build or import a stack, then run your function against it. These functions are stored in the preferences system much like the stacks and memory slots. `list func` will show a list of functions and their steps.
+The following commands are not recorded.
+- frac
+- list
+- debug
+- ver
+- h or ?
+- record
+- function
+- cx or x or exit
+
|Command|Description|
|-------|-----------|
|record on|Turn on recording. Most commands and numbers entered after record is enabled will be saved. There are some that are excluded from being recorded|
|record off| Turn off recording. The user will be prompted to enter in a name for this function and that name will be used to run it in the future. If you do not enter in a name the recording is canceled and nothing will be saved|
-|func del NAME|Delete a saved function. The name must match the one given when saved. A list of functions can be viewed with `list func`|
|func run|Execute the saved user defined function with the current stack as the starting point|
+|func del NAME|Delete a saved function. The name must match the one given when saved. A list of functions can be viewed with `list func`. Undo will not recover a deleted function|
+|func delall|Delete all saved user defined functions. Please note that undo will not recover deleted functions|
**Example:**
- `c` Clear the stack
diff --git a/pom.xml b/pom.xml
index 456a418..a33d95a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
org.fross
rpncalc
- 3.2.0
+ 3.2.1
jar
rpncalc
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index bf0dca0..3d85f1d 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -1,5 +1,5 @@
name: rpncalc
-version: '3.2.0'
+version: '3.2.1'
summary: The command line Reverse Polish Notation (RPN) calculator
description: |
RPNCalc is an easy to use command line based Reverse Polish
diff --git a/src/main/java/org/fross/rpncalc/Help.java b/src/main/java/org/fross/rpncalc/Help.java
index f12e660..eeddcc0 100644
--- a/src/main/java/org/fross/rpncalc/Help.java
+++ b/src/main/java/org/fross/rpncalc/Help.java
@@ -118,9 +118,10 @@ public static void Display() {
Output.printColorln(Ansi.Color.YELLOW, "\nUser Defined Functions:");
Output.printColorln(Ansi.Color.WHITE, " record on Turn on command recording");
Output.printColorln(Ansi.Color.WHITE, " record off Disable recording");
- Output.printColorln(Ansi.Color.WHITE, " func del NAME Delete named user defined function");
Output.printColorln(Ansi.Color.WHITE, " func run NAME Run the named user function on current stack");
-
+ Output.printColorln(Ansi.Color.WHITE, " func del NAME Delete named user defined function");
+ Output.printColorln(Ansi.Color.WHITE, " func delall Delete all user defined functions");
+
Output.printColorln(Ansi.Color.YELLOW, "\nOperational Commands:");
Output.printColorln(Ansi.Color.WHITE, " list stacks Show the list of saved stacks");
diff --git a/src/main/java/org/fross/rpncalc/UserFunctions.java b/src/main/java/org/fross/rpncalc/UserFunctions.java
index f0ea8e6..b29bc3b 100644
--- a/src/main/java/org/fross/rpncalc/UserFunctions.java
+++ b/src/main/java/org/fross/rpncalc/UserFunctions.java
@@ -74,14 +74,29 @@ public static void cmdFunction(String args) {
String command[] = args.toLowerCase().trim().split("\\s", 2);
try {
- if (command[0].startsWith("del")) {
+ if (command[0].equals("del")) {
try {
FunctionDelete(command[1]);
} catch (ArrayIndexOutOfBoundsException ex) {
Output.printColorln(Ansi.Color.RED, "ERROR: 'function del' requires a valid function name to delete");
return;
}
- } else if (command[0].startsWith("run")) {
+
+ } else if (command[0].equals("delall")) {
+ Preferences p = Preferences.userRoot().node(UserFunctions.PREFS_PATH_FUNCTIONS);
+
+ // Loop through each function (child of the root) and delete it
+ try {
+ for (String functionName : p.childrenNames()) {
+ Output.debugPrint("Removing function: " + functionName);
+ FunctionDelete(functionName);
+ }
+ } catch (BackingStoreException e) {
+ Output.printColorln(Ansi.Color.RED, "Error: Could not remove the user defined functions");
+ return;
+ }
+
+ } else if (command[0].equals("run")) {
try {
FunctionRun(command[1]);
} catch (ArrayIndexOutOfBoundsException ex) {
@@ -114,7 +129,7 @@ public static boolean RecordingEnabled() {
*/
public static void RecordCommand(String arg) {
// Ignore the following commands from recording
- String[] ignore = { "list", "debug", "ver", "h", "?", "record", "function", "cx", "x", "exit" };
+ String[] ignore = { "frac", "list", "debug", "ver", "h", "?", "record", "function", "cx", "x", "exit" };
// If the command starts with an ignored item, just return before adding it to the recording
for (int i = 0; i < ignore.length; i++) {