Hello I am doing a CLI (shell-like) application and I have a problem when I
split my arguments
milerius@inspiron:~/Documents/EIP/albinos/albinos-editor$ LD_LIBRARY_PATH=.
./albinos_editor --cli
Usage:
help (show this message)
exit (quitting the app)
clear (clear the screen)
config create <name> (create a config with the given name)
config load <file> (load config from the key in the given file)
setting update <name> <value> (update setting with the given name
to the given value)
albinos-editor> config create "a configuration"
Run
In the example above I have a quoted argument. I use the strutils split
function to get my arguments in an array.
while true:
var cline = replxx_input(repl, prompt);
if cline == nil:
styledEcho(fgMagenta, "Quitting CLI mode...")
break
let line = $cline
if line.len == 0 or isSpaceAscii(line):
continue
let args = line.unindent.splitWhitespace
Run
But in fact i get something like ["config", "create", "a", "configuration"] but
i want something like ["config", "create", "a configuration"]
There is a way using strutils or regex package to split on whitespace but
ignoring space in quoted arguments ?