File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed
Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change 33-- concatenate a collection of lua modules into one
44
55require " lfs"
6+ require " alt_getopt"
67
78import insert, concat from table
8- import dump from require " moonscript.util"
9+ import dump, split from require " moonscript.util"
910
10- if not arg[ 1 ]
11- print " usage: splat directory [directories...]"
11+ opts, ind = alt_getopt. get_opts arg, " l:" , {
12+ load : " l"
13+ }
14+
15+ if not arg[ ind]
16+ print " usage: splat [-l module_names] directory [directories...]"
1217 os.exit !
1318
14- dirs = [ a for a in * arg[ , ]]
19+ dirs = [ a for a in * arg[ ind , ]]
1520
1621normalize = ( path) ->
1722 path\ match( " (.-)/*$" ) .. " /"
@@ -68,8 +73,8 @@ for dir in *dirs
6873 name = base
6974 write_module name, content
7075
71- for dir in * dirs
72- module_name = dir \ gsub ( " / " , " . " ) \ gsub ( " %.$ " , " " )
73- if modules[ module_name]
74- print ( [[ package.preload["%s"]()]] ) \ format module_name
76+ if opts . l
77+ for module_name in * split opts . l , " , "
78+ if modules[ module_name]
79+ print ( [[ package.preload["%s"]()]] ) \ format module_name
7580
You can’t perform that action at this time.
0 commit comments