From 21dbc36d015ca45b7ec41d8d96aa6f32b4680b24 Mon Sep 17 00:00:00 2001 From: alemi Date: Tue, 6 Aug 2024 18:48:54 +0200 Subject: [PATCH] feat: improved login command generates random username, default password but whatever server is going to do a real check eventually --- src/command.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/command.lua b/src/command.lua index a8e86ea..fcfd6bb 100644 --- a/src/command.lua +++ b/src/command.lua @@ -19,7 +19,10 @@ vim.api.nvim_create_user_command( "MP", function (args) if args.fargs[1] == "login" then - client.login(args.fargs[2], args.fargs[3], args.fargs[4]) + if #args.fargs < 2 then error("missing workspace name") end + local user = vim.fn.input("username > ", "user-" .. vim.fn.rand() % 1024) + local password = vim.fn.input("password > ", "lmaodefaultpassword") + client.login(user, password, args.fargs[2]) elseif args.fargs[1] == "create" then if #args.fargs < 2 then error("missing buffer name") end if client.workspace == nil then error("connect to a workspace first") end