@@ -87,22 +87,22 @@ export default_plugins = {n: 0}
87
87
88
88
fast_push default_plugins,
89
89
name: "lua"
90
- searchpath: (packer , name) -> searchpath_compat name, package.path
90
+ searchpath: (_ , name) -> searchpath_compat name, package.path
91
91
92
92
if "table" == type yue
93
93
fast_push default_plugins,
94
94
name: "yuescript"
95
- searchpath: (packer , name) -> searchpath_compat name, package_path_with_different_extension "yue"
96
- loader: (packer, name , filename, content) ->
95
+ searchpath: (_ , name) -> searchpath_compat name, package_path_with_different_extension "yue"
96
+ loader: (_, _ , filename, content) ->
97
97
return false unless check_file_extension filename, ".yue"
98
98
lua = yue.to_lua content, reserve_line_number: false
99
99
lua, replace_file_extension filename, ".yue", ".lua"
100
100
101
101
if "table" == type moon
102
102
fast_push default_plugins,
103
103
name: "moonscript"
104
- searchpath: (packer , name) -> searchpath_compat name, package_path_with_different_extension "moon"
105
- loader: (packer, name , filename, content) ->
104
+ searchpath: (_ , name) -> searchpath_compat name, package_path_with_different_extension "moon"
105
+ loader: (_, _ , filename, content) ->
106
106
return false unless check_file_extension filename, ".moon"
107
107
lua = moon.to_lua content
108
108
lua, replace_file_extension filename, ".moon", ".lua"
@@ -293,9 +293,12 @@ cli = (arguments) ->
293
293
294
294
if options.standalone
295
295
local content
296
- with io.open filename, "r"
297
- content = ::read "*a"
298
- ::close!
296
+ do
297
+ fd = io.open filename, "r"
298
+ error "file not found: #{filename}" unless fd?
299
+ with fd
300
+ content = ::read "*a"
301
+ ::close!
299
302
packer::include name for name in content::gmatch "[^\n]+"
300
303
else
301
304
packer::pack filename
@@ -304,9 +307,12 @@ cli = (arguments) ->
304
307
outfile = options.outfile or filename::gsub "%.(%a+)$", ".packed.lua"
305
308
print "Packed into #{outfile}"
306
309
break if filename == outfile
307
- with io.open outfile, "w"
308
- ::write packed
309
- ::close!
310
+ do
311
+ fd = io.open outfile, "w"
312
+ error "could not open file" unless fd?
313
+ with fd
314
+ ::write packed
315
+ ::close!
310
316
311
317
312
318
check_cli = =>
0 commit comments