mirror of https://github.com/Hilbis/Hilbish
feat: make cd builtin work with env variables (resolves #43)
parent
9b3f8e818c
commit
80029cfff3
|
@ -12,6 +12,8 @@ commander.register('cd', function (args)
|
|||
for i = 1, #args do
|
||||
path = path .. tostring(args[i]) .. ' '
|
||||
end
|
||||
path = path:gsub('$%$','\0'):gsub('${([%w_]+)}', os.getenv)
|
||||
:gsub('$([%w_]+)', os.getenv):gsub('%z','$')
|
||||
|
||||
local ok, err = pcall(function() fs.cd(path) end)
|
||||
if not ok then
|
||||
|
|
Loading…
Reference in New Issue