Home: https://github.com/asmagill/mjolnir_asm.ipc
Interface with Mjolnir from the command line.
To install the command line tool, you also need to install mjolnir._asm.ipc.cli
.
This module is based primarily on code from the previous incarnation of Mjolnir by Steven Degutis.
mjolnir._asm.ipc.get_cli_colors() -> table
Returns a table containing three keys, initial
, input
, and output
, which contain the terminal escape codes to generate the colors used in the command line interface.
mjolnir._asm.ipc.handler(str) -> value
The default handler for IPC, called by mjolnir-cli. Default implementation evals the string and returns the result.
You may override this function if for some reason you want to implement special evaluation rules for executing remote commands.
The return value of this function is always turned into a string via tostring() and returned to mjolnir-cli.
If an error occurs, the error message is returned instead.
mjolnir._asm.ipc.reset_cli_colors()
Erases any color changes you have made and resets the terminal to the original defaults.
mjolnir._asm.ipc.set_cli_colors(table) -> table
Takes as input a table containing one or more of the keys initial
, input
, or output
to set the terminal escape codes to generate the colors used in the command line interface. Each can be set to the empty string if you prefer to use the terminal window default. Returns a table containing the changed color codes.
For a brief intro into terminal colors, you can visit a web site like this one (http://jafrog.com/2013/11/23/colors-in-terminal.html) (I have no affiliation with this site, it just seemed to be a clear one when I looked for an example... you can use Google to find many, many others). Note that Lua doesn't support octal escapes in it's strings, so use \x1b
or \27
to indicate the escape
character.
e.g. ipc.set_cli_colors{ initial = "", input = "\27[33m", output = "\27[38;5;11m" }