

Ask HN: Best framework for building a command line language? - kator

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.<p>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?<p>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.<p>Example usage might be:<p>&#62; LOGIN myname
Password: <i></i><i></i><i></i><i></i><i></i>
AUTH SUCCESS
&#62; LIST THINGS
&#62; SET THING 123:Name = "Hello"
&#62; SAVE<p>etc..<p>Maybe some sort of interactive parser/lexer library in python or something like that?<p>Suggestions?
======
qznc
Too 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
It'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?

