2021-03-21 16:41:23 +00:00
|
|
|
-- The preload file initializes everything else for our shell
|
|
|
|
-- Currently it just adds our builtins
|
|
|
|
|
|
|
|
local fs = require 'fs'
|
|
|
|
local commander = require 'commander'
|
2021-03-31 03:58:12 +00:00
|
|
|
local bait = require 'bait'
|
2021-03-21 16:41:23 +00:00
|
|
|
|
|
|
|
commander.register('cd', function (path)
|
|
|
|
if #path == 1 then
|
2021-03-31 03:58:12 +00:00
|
|
|
local ok, err = pcall(function() fs.cd(path[1]) end)
|
|
|
|
if not ok then
|
|
|
|
if err == 1 then
|
2021-03-31 03:59:59 +00:00
|
|
|
print('directory does not exist')
|
2021-03-31 03:58:12 +00:00
|
|
|
end
|
|
|
|
end
|
2021-03-31 03:59:59 +00:00
|
|
|
return
|
2021-03-21 16:41:23 +00:00
|
|
|
end
|
2021-03-31 03:59:59 +00:00
|
|
|
fs.cd(os.getenv 'HOME')
|
2021-03-21 16:41:23 +00:00
|
|
|
end)
|