the folowing code snippet is used in one of my applications
and - of course - it works, but - of course - could be better.
The main problem I have with this, is complete lack of editing
functionality not even mentioning gimmicks like expansion or
reverse-search etc. (all nice thingies I´m used from the bash):
cmd_select is just a huge if ... elsif function.CMD: while($exit eq FALSE) { # We´re as long in the lo +op until no exitflag print "> "; $line = <STDIN>; # read input from stdin chop $line; goto CMD if(!$line); # chop CR and if input wa +s empty.. REDO ($key,@param) = split ' ', $line; # split key and parameter +s $exit = &cmd_select($key,@param); }
Now if I happen (and that happens often) to type in something
wrong, I have noch chance of editing it. Instead of Backspace
theres a ^H, instead of "Cursor-Up" theres some ^[OA and so
on.
How - o how my brothers can I get a decent CLI?
Obligatory question: Is there a module? :-)
Ciao
In reply to crafting a decent CLI by PetaMem
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |