From aff8ffe0646899d5bedf6a8d2d88fff257645c45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sat, 31 Dec 2016 19:31:32 +0100 Subject: vis: allow user registered :-commands to specify a help text --- vis-lua.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'vis-lua.c') diff --git a/vis-lua.c b/vis-lua.c index 5c8c46e..8925d24 100644 --- a/vis-lua.c +++ b/vis-lua.c @@ -903,6 +903,7 @@ static bool command_lua(Vis *vis, Win *win, void *data, bool force, const char * * @function command_register * @tparam string name the command name * @tparam function command the Lua function implementing the command + * @tparam[opt] string help the single line help text as displayed in `:help` * @treturn bool whether the command has been successfully registered * @usage * TODO @@ -911,7 +912,8 @@ static int command_register(lua_State *L) { Vis *vis = obj_ref_check(L, 1, "vis"); const char *name = luaL_checkstring(L, 2); const void *func = func_ref_new(L, 3); - bool ret = vis_cmd_register(vis, name, (void*)func, command_lua); + const char *help = luaL_optstring(L, 4, ""); + bool ret = vis_cmd_register(vis, name, help, (void*)func, command_lua); lua_pushboolean(L, ret); return 1; } -- cgit v1.2.3