3 ms·
Ask HN: Best framework for building a command line language?
I'm looking for develop a command-line interface to an API and allow simple things like SET, GET, LIST, etc. to make it very easy to configure and execute for people with little experience with the underlying API.
Is there a good way to go about this with an existing framework that will include stuff like token parsing, maybe variables and history etc?
I've started on a bunch of small shell script files but it gets a bit tedious and I don't want to do a full blown bison/yacc parser etc.
Example usage might be:
> LOGIN myname
Password:
AUTH SUCCESS
> LIST THINGS
> SET THING 123:Name = "Hello"
> SAVE
etc..
Maybe some sort of interactive parser/lexer library in python or something like that?
Suggestions?
- qznc 14y agoToo vague. What kind of API are you talking about (Web, C, Python, ...)? You might want to look at TCL, if you want to provide a "shell" for an "application".
- kator 14y agoIt's a REST api that is used to manipulate objects. And yes I want to build a "shell" or CLI to manipulate objects via the REST api and want to to be approchable by people without a lot of experience with the underlying API. something like: > new customer customer> set name to "Hello" customer> set currency to "USD" customer> set address to "1234 Somewhere, CA" customer> save >>> new customer created, id 112884 > show customer 112884 >>> id: 112884 >>> name: Hello >>> address: 1234 Somewhere, CA >>> currency: USD >>> other-attribute: default >>> something-else: NULL > quit >>> have a nice day Is that a bit clearer?