fix: display error to user if dir does not exist

pull/21/head^2
TorchedSammy 2021-03-30 23:58:12 -04:00
parent 0d5c826f54
commit 7326cb77c6
1 changed files with 7 additions and 1 deletions

View File

@ -3,9 +3,15 @@
local fs = require 'fs' local fs = require 'fs'
local commander = require 'commander' local commander = require 'commander'
local bait = require 'bait'
commander.register('cd', function (path) commander.register('cd', function (path)
if #path == 1 then if #path == 1 then
fs.cd(path[1]) local ok, err = pcall(function() fs.cd(path[1]) end)
if not ok then
if err == 1 then
print("directory does not exist")
end
end
end end
end) end)