Skip to content

Instantly share code, notes, and snippets.

@hdonnay
Created November 20, 2019 21:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hdonnay/1de94756b3f67f623e0d090b89608cd5 to your computer and use it in GitHub Desktop.
Save hdonnay/1de94756b3f67f623e0d090b89608cd5 to your computer and use it in GitHub Desktop.
import "strings"
qstring:: {
value: string
output: "'\(value)'"
}
arg: string | {output:string}
cmd: {
exe: string
argv: [...arg]
line: "\(exe) \(_compiled)"
_compiled = strings.Join([ (x&string)|x.output for x in argv ], " ")
}
hello: cmd & {
exe: "echo"
argv: [
"hello",
qstring&{value:"world"},
]
}
out:: hello.line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment