From abf07e978d668cb16f04583d110ef81d15fe0d7d Mon Sep 17 00:00:00 2001 From: Paul Ouellette Date: Tue, 30 Jul 2019 00:20:59 -0400 Subject: [PATCH] Zsh completions: escape ` and $ in descriptions --- src/argparse.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/argparse.lua b/src/argparse.lua index bae8fdc..a91da95 100644 --- a/src/argparse.lua +++ b/src/argparse.lua @@ -1329,7 +1329,7 @@ function Parser:_zsh_arguments(buf, cmd_name, indent) table.insert(line, option._name) end if option._description then - local description = get_short_description(option):gsub('["%]:]', "\\%0") + local description = get_short_description(option):gsub('["%]:`$]', "\\%0") table.insert(line, "[" .. description .. "]") end if option._maxargs == math.huge then @@ -1388,7 +1388,7 @@ function Parser:_zsh_cmds(buf, cmd_name) table.insert(line, '"' .. command._name) end if command._description then - table.insert(line, ":" .. get_short_description(command):gsub('["]', "\\%0")) + table.insert(line, ":" .. get_short_description(command):gsub('["`$]', "\\%0")) end table.insert(buf, " " .. table.concat(line) .. '"') end