2
2
réplica de https://github.com/Hilbis/Hilbish synced 2025-06-30 16:22:03 +00:00

feat: make cd builtin work with env variables (resolves #43)

Este commit está contenido en:
sammy 2021-05-01 13:31:51 -04:00
padre 9b3f8e818c
commit 80029cfff3
No se encontró ninguna clave conocida en la base de datos para esta firma
ID de clave GPG: 50EE40A2809851F5

Ver fichero

@ -12,6 +12,8 @@ commander.register('cd', function (args)
for i = 1, #args do for i = 1, #args do
path = path .. tostring(args[i]) .. ' ' path = path .. tostring(args[i]) .. ' '
end end
path = path:gsub('$%$','\0'):gsub('${([%w_]+)}', os.getenv)
:gsub('$([%w_]+)', os.getenv):gsub('%z','$')
local ok, err = pcall(function() fs.cd(path) end) local ok, err = pcall(function() fs.cd(path) end)
if not ok then if not ok then