shim: command line library for lua.

Write scripts as Lua libraries, execute them in the shell.

This is a tiny Lua module that makes it easy to write utilities that work from either bash or Lua.

Usage:

#!/usr/bin/env -S lua -e "require'pkglib'()"
local shim = require'shim'

local M = shim.cmd'myModName' {
  'arg [type]: documentation',
    arg = 'default-value',
}

-- ... nomral lua module
function M.someFunction() ... end

if shim.isMain(M) then M:main(arg) end
return M -- return as library

Mod shim

shim: command line library for lua.

Functions