Rename lush Lua API: command→capture, subcmd→run, getenv→envget, setenv→envset
Lua-facing names only; C internals unchanged.
lush.capture(str) — return {code, stdout, stderr} table
lush.run(str) — return stripped stdout string
lush.interactive(str) — run with TTY, set _, return result
lush.envget(name) — get environment variable
lush.envset(name,val) — set environment variable
This commit is contained in:
16
lcmd.c
16
lcmd.c
@@ -1270,11 +1270,11 @@ int lushCmd_setenv (lua_State *L) {
|
||||
TString *lushname[LUSH_OP_COUNT];
|
||||
|
||||
static const luaL_Reg lushlib[] = {
|
||||
{"command", lushCmd_command},
|
||||
{"capture", lushCmd_command},
|
||||
{"interactive", lushCmd_interactive},
|
||||
{"getenv", lushCmd_getenv},
|
||||
{"setenv", lushCmd_setenv},
|
||||
{"subcmd", lushCmd_subcmd},
|
||||
{"run", lushCmd_subcmd},
|
||||
{"envget", lushCmd_getenv},
|
||||
{"envset", lushCmd_setenv},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
@@ -1287,11 +1287,11 @@ LUAMOD_API int luaopen_lush (lua_State *L) {
|
||||
lua_createtable(L, 0, 4);
|
||||
lua_setfield(L, -2, "commands");
|
||||
/* intern function name strings for OP_LUSH VM access */
|
||||
lushname[LUSH_OP_COMMAND] = luaS_new(L, "command");
|
||||
lushname[LUSH_OP_COMMAND] = luaS_new(L, "capture");
|
||||
lushname[LUSH_OP_INTERACTIVE] = luaS_new(L, "interactive");
|
||||
lushname[LUSH_OP_GETENV] = luaS_new(L, "getenv");
|
||||
lushname[LUSH_OP_SETENV] = luaS_new(L, "setenv");
|
||||
lushname[LUSH_OP_SUBCMD] = luaS_new(L, "subcmd");
|
||||
lushname[LUSH_OP_GETENV] = luaS_new(L, "envget");
|
||||
lushname[LUSH_OP_SETENV] = luaS_new(L, "envset");
|
||||
lushname[LUSH_OP_SUBCMD] = luaS_new(L, "run");
|
||||
/* store in registry for OP_LUSH access */
|
||||
lua_pushvalue(L, -1);
|
||||
lua_rawseti(L, LUA_REGISTRYINDEX, LUA_RIDX_LUSH);
|
||||
|
||||
Reference in New Issue
Block a user