all repos — min @ 4bfc26e2d636cba7d3dd132a307c7bccc1fa1bc4

A small but practical concatenative programming language.

Implemented autocompletion for files, env vars, and symbols.
h3rald h3rald@h3rald.com
Sun, 04 Sep 2016 13:49:45 +0200
commit

4bfc26e2d636cba7d3dd132a307c7bccc1fa1bc4

parent

e109d19de0a5cbc4a24240c4fe81f32f2b87ca3f

1 files changed, 17 insertions(+), 1 deletions(-)

jump to
M minim.nimminim.nim

@@ -50,8 +50,24 @@ var w = if words.len > 0: words.pop else: ""

var sep = "" if words.len > 0: sep = " " + if w.startsWith("'"): + for s in CURRSCOPE.symbols.keys: + if startsWith("'$1"%s, w): + linenoiseAddCompletion completions, words.join(" ") & sep & "'" & s + return + if w.startsWith("$"): + for s,v in envPairs(): + if startsWith("$$1"%s, w): + linenoiseAddCompletion completions, words.join(" ") & sep & "$" & s + return + if w.startsWith("\""): + let w1 = w[1..w.len-1] + for c,s in walkDir(getCurrentDir(), true): + if startsWith("\"$1"%s, w): + linenoiseAddCompletion completions, words.join(" ") & sep & "\"" & s & "\"" + return for s in CURRSCOPE.symbols.keys: - if startsWith(s, w): + if s.startsWith(w): linenoiseAddCompletion completions, words.join(" ") & sep & s proc prompt(s: string): string =