def Zsh.esc

cli@0.2.0.0 · cli.bend:6161

import cli@0.2.0.0/cli.bend as Cli
import Base

6161# Text in an _arguments spec or a _describe entry, with \, [, ] and :
6162# backslash-escaped (P5).
6163def Zsh.esc(s: String) -> String:
6164  match s:
6165    case SNil{}: SNil{}
6166    case SCon{Chr{92}, tail}: String.append("\\\\", Zsh.esc(tail))
6167    case SCon{Chr{91}, tail}: String.append("\\[", Zsh.esc(tail))
6168    case SCon{Chr{93}, tail}: String.append("\\]", Zsh.esc(tail))
6169    case SCon{Chr{58}, tail}: String.append("\\:", Zsh.esc(tail))
6170    case SCon{c, tail}: SCon{c, Zsh.esc(tail)}

Uses (7)

Used by (4)