proxmark3/client/luascripts/examples/example_cmdline.lua

20 lines
523 B
Lua
Raw Normal View History

2019-09-05 05:36:23 +08:00
#!/usr/bin/env -S pm3 -l
2019-05-08 04:48:18 +08:00
--[[
A sampe script file on how to implement at cmd line inteface.
2019-09-05 05:36:23 +08:00
It also demonstrates how the script can be used with a shebang.
2019-05-08 04:48:18 +08:00
--]]
print("This is how a cmd-line interface could be implemented\nPrint 'exit' to exit.\n")
local answer
repeat
2019-03-09 17:34:43 +08:00
io.write("$>")
io.flush()
2019-05-08 04:48:18 +08:00
answer = io.read()
2019-03-09 17:34:43 +08:00
if answer ~= 'exit' then
local func = assert(loadstring("return " .. answer))
io.write("\n"..tostring(func() or "").."\n");
end--]]
2019-05-08 04:48:18 +08:00
until answer == "exit"
print("Bye\n");