util.prosodyctl.shell: Save readline history
authorKim Alvefur <zash@zash.se>
Tue, 02 Jun 2020 09:35:07 +0200
changeset 10881 2b015ef8cd06
parent 10880 c01c39a2c7a2
child 10882 b37dc3776f69
util.prosodyctl.shell: Save readline history
util/prosodyctl/shell.lua
--- a/util/prosodyctl/shell.lua	Tue Jun 02 08:41:05 2020 +0100
+++ b/util/prosodyctl/shell.lua	Tue Jun 02 09:35:07 2020 +0200
@@ -10,6 +10,10 @@
 
 if have_readline then
 	readline.set_readline_name("prosody");
+	readline.set_options({
+			histfile = path.join(prosody.paths.data, ".shell_history");
+			ignoredups = true;
+		});
 end
 
 local function read_line()
@@ -31,6 +35,9 @@
 		if not line then
 			print("");
 		end
+		if have_readline then
+			readline.save_history();
+		end
 		os.exit();
 	end
 	send_line(client, line);