Skip to content

Instantly share code, notes, and snippets.

@promovicz
promovicz / demo.txt
Last active October 25, 2020 10:21
New dylan command-interface completion and help
prom@horsey:/extra/Projects/opendylan/libraries/command-interface$ _build/bin/command-interface-demo
>
Commands:
configure - Modify configuration
show - Show information
echo - Command
directory - Show information about directory
examine - Command
error - Fail miserably
quit - Quit the shell
define cli-command $root (fnord)
help "Fnord, whatever that means...";
named parameter file :: <cli-file>,
must-exist?: #t;
named parameter oneof :: <cli-oneof>,
alternatives: #("bla", "blubb", "boo");
end;
@promovicz
promovicz / lexer.dylan
Last active October 25, 2020 10:23
CLI lexer
for(char in string, offset from 0)
select(state)
#"initial" =>
case
char.whitespace? =>
maybe-push-collected();
char = '"' =>
state := #"dquote";
char = '?' =>
if(collected-start)
@promovicz
promovicz / demo.txt
Last active October 25, 2020 10:24
State of CLI
prom@kitten:~$ cli help sho
configuration interface log route
prom@kitten:~$ cli help sho interface
SHOW INTERFACE
Query the interface database
prom@kitten:~$ cli shell
> sh