-
Notifications
You must be signed in to change notification settings - Fork 9
/
import.lua
34 lines (26 loc) · 909 Bytes
/
import.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package.path = "lualib/?.lua;"..package.path
local argparse = require "argparse"
local bash = require "bash"
local github = require "github"
local libs = require "libs"
local function echo(str)
print(bash.format(str))
end
local function file_exists(str)
return bash.file_exists(bash.format(str))
end
echo "welcome to skynet creator !"
local parser = argparse("main.lua")
parser:description("skynet creator import tool")
parser:option("--force"):default("false"):description("force remove if workdir is exist")
parser:argument("workdir"):description("the path of skynet project you want to import.")
parser:argument("modules"){args = "*"}:description("the modules you want to import.")
local args = parser:parse()
local root = args.workdir
if not file_exists(root) then
echo "workdir ${root} is not exist"
return
end
for _, name in pairs(args.modules) do
libs.import(root, name)
end