mirror of
https://github.com/TangentFoxy/argparse.git
synced 2025-07-28 02:52:20 +00:00
Zsh completions: escape ` and $ in descriptions
This commit is contained in:
@@ -1329,7 +1329,7 @@ function Parser:_zsh_arguments(buf, cmd_name, indent)
|
|||||||
table.insert(line, option._name)
|
table.insert(line, option._name)
|
||||||
end
|
end
|
||||||
if option._description then
|
if option._description then
|
||||||
local description = get_short_description(option):gsub('["%]:]', "\\%0")
|
local description = get_short_description(option):gsub('["%]:`$]', "\\%0")
|
||||||
table.insert(line, "[" .. description .. "]")
|
table.insert(line, "[" .. description .. "]")
|
||||||
end
|
end
|
||||||
if option._maxargs == math.huge then
|
if option._maxargs == math.huge then
|
||||||
@@ -1388,7 +1388,7 @@ function Parser:_zsh_cmds(buf, cmd_name)
|
|||||||
table.insert(line, '"' .. command._name)
|
table.insert(line, '"' .. command._name)
|
||||||
end
|
end
|
||||||
if command._description then
|
if command._description then
|
||||||
table.insert(line, ":" .. get_short_description(command):gsub('["]', "\\%0"))
|
table.insert(line, ":" .. get_short_description(command):gsub('["`$]', "\\%0"))
|
||||||
end
|
end
|
||||||
table.insert(buf, " " .. table.concat(line) .. '"')
|
table.insert(buf, " " .. table.concat(line) .. '"')
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user