-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathonelua.lua
More file actions
37 lines (28 loc) · 1.27 KB
/
onelua.lua
File metadata and controls
37 lines (28 loc) · 1.27 KB
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
35
36
37
--==============================================================================
-- Unite all Lua dependencies into just ONE file <tonyp@acm.org>
-- This is a completely self-contained version -- no external dependencies
--==============================================================================
local one = require 'one'
local cli = require 'cli'
local option = cli.get_all_options()
--==============================================================================
local filename = cli.get_argument(1)
if filename == nil then
print 'Copyright (c) 2021 by Tony Papadimitriou <tonyp@acm.org>\n'
print('Usage: '.. arg[0]:match('[^\\/]+$') ..' <main_lua_file> [<new_lua_file>]')
print [[Create a single Lua source by combining all requirements into one file
Options:
-E ignore environment variables
]]
return
end
local outfile = one.unite(filename,true,option.E) -- unite the given file into a table
--------------------------------------------------------------------------------
-- If no 2nd argument is given, print to console, else write to given filename
--------------------------------------------------------------------------------
filename = cli.get_argument(2)
if filename == nil then
print(cc(outfile,'\n'))
else
putfile(filename,outfile)
end