From cff7827aced8be842c4ae62c9af2b0e991971cd4 Mon Sep 17 00:00:00 2001 From: sammyette <38820196+TorchedSammy@users.noreply.github.com> Date: Fri, 8 Oct 2021 09:49:57 -0400 Subject: [PATCH] fix: trim extra whitespace from cd args this fixed an issue with `cd -` not working --- preload.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/preload.lua b/preload.lua index 7cf4e7f..2f5e2f2 100644 --- a/preload.lua +++ b/preload.lua @@ -16,7 +16,7 @@ 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*(.-)%s*$', '%1') if path == '-' then path = oldDir