Skip to content

Commit 508afe8

Browse files
committed
add preload-module argument to setup config before running the command
1 parent 7f16605 commit 508afe8

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ lint: build
77
moonc -l lapis
88

99
local: build
10-
luarocks make --local lapis-annotate-dev-1.rockspec
10+
luarocks make --local --lua-version=5.1 lapis-annotate-dev-1.rockspec
1111

1212
build:
1313
moonc lapis

lapis/cmd/actions/annotate.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,13 @@ return {
147147
usage = "annotate models/model1.moon models/model2.moon ...",
148148
help = "annotate a model with schema",
149149
function(self, flags, ...)
150+
do
151+
local mod_name = flags["preload-module"]
152+
if mod_name then
153+
assert(type(mod_name) == "string", "preload-module must be a astring")
154+
require(mod_name)
155+
end
156+
end
150157
local args = {
151158
...
152159
}

lapis/cmd/actions/annotate.moon

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ annotate_model = (config, fname) ->
101101
help: "annotate a model with schema"
102102

103103
(flags, ...) =>
104+
105+
if mod_name = flags["preload-module"]
106+
assert type(mod_name) == "string", "preload-module must be a astring"
107+
require(mod_name)
108+
104109
args = { ... }
105110
config = require("lapis.config").get!
106111

0 commit comments

Comments
 (0)