fix: trim extra whitespace from cd args

this fixed an issue with `cd -` not working
pull/73/head
sammyette 2021-10-08 09:49:57 -04:00
parent 400dd2944d
commit cff7827ace
No known key found for this signature in database
GPG Key ID: 50EE40A2809851F5
1 changed files with 1 additions and 1 deletions

View File

@ -16,7 +16,7 @@ commander.register('cd', function (args)
path = path .. tostring(args[i]) .. ' ' path = path .. tostring(args[i]) .. ' '
end end
path = path:gsub('$%$','\0'):gsub('${([%w_]+)}', os.getenv) path = path:gsub('$%$','\0'):gsub('${([%w_]+)}', os.getenv)
:gsub('$([%w_]+)', os.getenv):gsub('%z','$') :gsub('$([%w_]+)', os.getenv):gsub('%z','$'):gsub('^%s*(.-)%s*$', '%1')
if path == '-' then if path == '-' then
path = oldDir path = oldDir