aboutsummaryrefslogtreecommitdiffstats
path: root/util/prosodyctl.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-04-29 02:10:55 +0100
committerMatthew Wild <mwild1@gmail.com>2012-04-29 02:10:55 +0100
commitfe228888c0d51612e8b32adc3f9db91b7c6e8ded (patch)
treee78baabff21e9b6fefaeef4a709098ca30b35922 /util/prosodyctl.lua
parent9d04baca862bcad5b49ac4ab0b9c3432321150d3 (diff)
parent1ee9f6e09228b268bf3f5dc985d4ba9026a72666 (diff)
downloadprosody-fe228888c0d51612e8b32adc3f9db91b7c6e8ded.tar.gz
prosody-fe228888c0d51612e8b32adc3f9db91b7c6e8ded.zip
Merge 0.9->trunk
Diffstat (limited to 'util/prosodyctl.lua')
-rw-r--r--util/prosodyctl.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/util/prosodyctl.lua b/util/prosodyctl.lua
index 2da39cb2..439de551 100644
--- a/util/prosodyctl.lua
+++ b/util/prosodyctl.lua
@@ -16,6 +16,7 @@ local signal = require "util.signal";
local set = require "util.set";
local lfs = require "lfs";
local pcall = pcall;
+local type = type;
local nodeprep, nameprep = stringprep.nodeprep, stringprep.nameprep;
@@ -63,6 +64,13 @@ function getchar(n)
end
end
+function getline()
+ local ok, line = pcall(io.read, "*l");
+ if ok then
+ return line;
+ end
+end
+
function getpass()
local stty_ret = os.execute("stty -echo 2>/dev/null");
if stty_ret ~= 0 then
@@ -112,6 +120,13 @@ function read_password()
return password;
end
+function show_prompt(prompt)
+ io.write(prompt, " ");
+ local line = getline();
+ line = line and line:gsub("\n$","");
+ return (line and #line > 0) and line or nil;
+end
+
-- Server control
function adduser(params)
local user, host, password = nodeprep(params.user), nameprep(params.host), params.password;