diff options
author | Matthew Wild <mwild1@gmail.com> | 2021-11-11 13:27:28 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2021-11-11 13:27:28 +0000 |
commit | 2077bef777bd630ab158e99ef55582885f7cefa7 (patch) | |
tree | 53cf72a2ed6ce5f6e9f709bd79da0bf0d55419a3 /util/prosodyctl | |
parent | fd09aa9659816dd6ad52efe9969fcfe6698adaa4 (diff) | |
download | prosody-2077bef777bd630ab158e99ef55582885f7cefa7.tar.gz prosody-2077bef777bd630ab158e99ef55582885f7cefa7.zip |
util.prosodyctl.shell: Allow setting custom prompt (admin_shell_prompt)
Diffstat (limited to 'util/prosodyctl')
-rw-r--r-- | util/prosodyctl/shell.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/util/prosodyctl/shell.lua b/util/prosodyctl/shell.lua index 79d96f15..214779ec 100644 --- a/util/prosodyctl/shell.lua +++ b/util/prosodyctl/shell.lua @@ -17,11 +17,11 @@ if have_readline then }); end -local function read_line() +local function read_line(prompt_string) if have_readline then - return readline.readline("prosody> "); + return readline.readline(prompt_string); else - io.write("prosody> "); + io.write(prompt_string); return io.read("*line"); end end @@ -31,7 +31,7 @@ local function send_line(client, line) end local function repl(client) - local line = read_line(); + local line = read_line(client.prompt_string or "prosody> "); if not line or line == "quit" or line == "exit" or line == "bye" then if not line then print(""); @@ -123,6 +123,8 @@ local function start(arg) --luacheck: ignore 212/arg end end); + client.prompt_string = config.get("*", "admin_shell_prompt"); + local socket_path = path.resolve_relative_path(prosody.paths.data, opts.socket or config.get("*", "admin_socket") or "prosody.sock"); local conn = adminstream.connection(socket_path, client.listeners); local ok, err = conn:connect(); |