diff options
| -rw-r--r-- | init.lua | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -34,23 +34,18 @@ end local function confirm(path) local choices = 'no\nyes' local prompt = path .. ' exists. Edit anyway:' - local cmd = 'printf "' .. choices .. '" | vis-menu -b -p \'' .. prompt .. '\'' + local cmd = 'printf %s \'' .. choices .. '\' | vis-menu -b -p \'' .. prompt .. '\'' - local choice = nil -- local status, output = vis:pipe(nil, {start = 0, finish = 0}, cmd) local menu = assert(io.popen(cmd)) local output = menu:read('*a') local _, _, status = menu:close() + vis:redraw() + if status == 0 then - -- trim newline from selection - if output:sub(-1) == '\n' then - choice = output:sub(1, -2) - else - choice = output - end + return 'yes' == output:sub(1, 3) end - vis:redraw() - return choice == 'yes' + return false end local created_locks = {} |
