-- examples/hello.lua: Minimal senl app
local sen = require("lua_sen")

-- Handlers
local function greet(ctx)
    local name = ctx.args.name or "World"
    local loud = ctx.args.loud
    local msg = "Hello, " .. name .. "!"
    if loud then
        msg = msg:upper()
    end
    return sen.ok(msg)
end

local function version(ctx)
    return sen.ok("hello v0.1.0")
end

-- CLI definition + routing
local app = sen.app("hello", "A friendly greeter")
    :version("0.1.0")
    :command("greet", "Say hello to someone")
        :arg("name", "Who to greet")
        :flag("l", "loud", "SHOUT THE GREETING")
        :done()
    :command("version", "Show version")
        :done()

app:route("greet", greet)
app:route("version", version)

return app:build()
