From 0d148f65e0eead4a2ea164d22ff844db428ebdb6 Mon Sep 17 00:00:00 2001 From: Autumn Date: Sun, 17 May 2026 15:12:52 +0100 Subject: [main] added placeholder echo & service fetching utils --- selenepaw.lua | 16 +++++++++++++++- src/actions.lua | 27 +++++++++++++++++++++++++++ src/help.lua | 38 +++++++++++++++++++++++++++++++++----- 3 files changed, 75 insertions(+), 6 deletions(-) create mode 100644 src/actions.lua diff --git a/selenepaw.lua b/selenepaw.lua index 704ff1a..3979d93 100644 --- a/selenepaw.lua +++ b/selenepaw.lua @@ -6,8 +6,22 @@ local help = require("src/help") -- check if no args -if not args then +if #arg == 0 then help.main() + return end + +-- run associated action +local actions = require("src/actions") +local action = actions[tostring(arg[1])] + +if not action then + + help.main() + return + +end + +action() diff --git a/src/actions.lua b/src/actions.lua new file mode 100644 index 0000000..e651854 --- /dev/null +++ b/src/actions.lua @@ -0,0 +1,27 @@ +-- +-- ~~~ selenepaw actions +-- + +-- load help messages +local help = require("src/help") + +-- 0000: echo +function echo () + + help.echo() + +end + +-- 0001: fetch service +function fetchservice () + + help.fetchservice () + +end + +-- return +return { + echo = echo, + + fetchservice = fetchservice +} diff --git a/src/help.lua b/src/help.lua index 0df6c51..7f0c82d 100644 --- a/src/help.lua +++ b/src/help.lua @@ -2,17 +2,45 @@ -- ~~~ help messages -- --- main function +-- main function main () print("\nSelenePaw - a Lua-based PawSD utility.") - print("\nCurrently this util does nothing, but here are some planned features:") - print("* echo-ing a service") - print("* fetching a service's records\n") + + print("\n*> Usage:") + print("\n lua selenepaw.lua ") + + print("\n*> Verbs:") + print("---*> 0000 - echo") + print("\n---*> 0001 - fetchservice\n") + +end + +-- 0000: echo +function echo () + + print("\nEcho (0000) - Send & receive the same data from a server.") + + print("\n*> Usage:") + print("\n lua selenepaw.lua echo \n") + +end + +-- 0001: fetch service +function fetchservice () + + print("\nFetch Service (0001) - Fetch a specific service from a service.") + + print("\n*> Usage:") + print("\n lua selenepaw.lua fetchservice \n") end -- return return { - main = main + main = main, + + echo = echo, + + fetchservice = fetchservice } -- cgit v1.3