persist utility

This commit is contained in:
kepler155c
2018-02-11 06:47:57 -05:00
parent ebe55c265e
commit 2a8617dab1

15
apps/persist.lua Normal file
View File

@@ -0,0 +1,15 @@
-- saves a virtual file to disk
_G.requireInjector(_ENV)
local Util = require('util')
local shell = _ENV.shell
local args = { ... }
local fileName = args[1] or error('Syntax: persist <file name>')
local c = Util.readFile(shell.resolve(fileName)) or error('Unable to open file')
Util.writeFile(shell.resolve(fileName), c)
print('Saved')