From 0c0bbc4282046d4d03823cfd7516fdd26509c127 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sun, 2 Jul 2023 12:35:08 +0200 Subject: [PATCH] feat: with lua Signed-off-by: kjuulh --- cuddle.yaml | 10 ++++++++-- scripts/lua/commands/init.lua | 11 +++++++++++ scripts/new_migration.sh | 2 +- scripts/test.lua | 5 +++++ 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 scripts/lua/commands/init.lua create mode 100644 scripts/test.lua diff --git a/cuddle.yaml b/cuddle.yaml index 8c866f3..c988ef5 100644 --- a/cuddle.yaml +++ b/cuddle.yaml @@ -20,12 +20,18 @@ scripts: type: shell new_migration: type: shell + description: "creates a new migration in `como_infrastructure` with the given name prefixed with a date" args: name: - type: "env" - key: "name" + type: "flag" + name: "name" + description: "the name of the migration" + required: true "sqlx:prepare": type: shell "deploy": type: shell + + "test": + type: lua diff --git a/scripts/lua/commands/init.lua b/scripts/lua/commands/init.lua new file mode 100644 index 0000000..cb7c2af --- /dev/null +++ b/scripts/lua/commands/init.lua @@ -0,0 +1,11 @@ +M = {} + +function M.something() + local io = require("io") + local output = io.popen("ls"):read("a*") + print(output) + + print("hello-world!") +end + +return M diff --git a/scripts/new_migration.sh b/scripts/new_migration.sh index 26acf15..cb05d65 100755 --- a/scripts/new_migration.sh +++ b/scripts/new_migration.sh @@ -2,4 +2,4 @@ export $(cat .env | xargs) -cargo sqlx migrate add --source como_infrastructure/migrations $name +cargo sqlx migrate add --source como_infrastructure/migrations $NAME diff --git a/scripts/test.lua b/scripts/test.lua new file mode 100644 index 0000000..3b6ba48 --- /dev/null +++ b/scripts/test.lua @@ -0,0 +1,5 @@ +print("from test") + +local init = require("commands") + +init.something()