chore: merge

pull/59/head
sammyette 2021-05-27 18:34:16 -04:00
commit ba6d7972e0
No known key found for this signature in database
GPG Key ID: 50EE40A2809851F5
1 changed files with 6 additions and 1 deletions

View File

@ -3,6 +3,7 @@
local fs = require 'fs'
local commander = require 'commander'
local bait = require 'bait'
local old_dir = os.getenv "PWD"
-- Builtins
commander.register('cd', function (args)
@ -13,8 +14,12 @@ commander.register('cd', function (args)
path = path .. tostring(args[i]) .. ' '
end
path = path:gsub('$%$','\0'):gsub('${([%w_]+)}', os.getenv)
:gsub('$([%w_]+)', os.getenv):gsub('%z','$')
:gsub('$([%w_]+)', os.getenv):gsub('%z','$'):gsub("%s+", "")
if path == '-' then
path = old_dir
end
old_dir = os.getenv "PWD"
local ok, err = pcall(function() fs.cd(path) end)
if not ok then
if err == 1 then