Developer Tools
vcmd
A line by line command interpreter: hand it a line, it calls the handler.
Released v1.0.0 · 2026-09-28use "stdlib/cmd.ven"
A line by line command interpreter: hand it a line and it calls the matching handler, under a prompt of your choosing.
loop = command_loop_new("> ")
print loop.prompt
:: >
Reference (3 functions)
API reference
command_loop_new(prompt)
Builds a new CommandLoop with an empty command table.
command_loop_new("> ").prompt
:: >register_command(loop, name, handler_fn)
Registers handler_fn under name on loop, in place.
loop = command_loop_new("> ")
register_command(loop, "echo", make(rest) give no)
dispatch_line(loop, "echo hello world")
:: nodispatch_line(loop, line)
Splits line into a command name and its rest, and dispatches it.
loop = command_loop_new("> ")
register_command(loop, "quit", make(rest) give yes)
dispatch_line(loop, "quit")
:: yes