I had quite similar task, integrating custom shell with clojure repl,
where all expressions between parenthesis
were interpreted as clojure code and rest as custom shell programs.

The best way to do this is to explore (clojure.main/repl) function.
One of the parameters will be :eval function; there clojure repl will
send
all expressions for evaluation. It could look like this:

(defn evaluate [expr]
  (if (re-find #"^(.*)$" expr)
    (eval expr)
    ;; here you call some java code for executing system commands
    ;; like (.exec (Runtime/getRuntime) expr) or something like that
) )

(clojure.main/repl
    :eval evaluate)

With clojure.main/repl you can do even more: write custom input,
output and such. Feel free to explore it ;)

Sanel

On Sep 20, 9:38 am, jaime <[email protected]> wrote:
> Hi guys,
>
> I want to implement a shell on top of REPL but without any ideas on
> how to do it. Could you please suggest?
>
> What I want is something that can let user do things like:
>     1. in REPL, user enter "(myshell)" (or some other command name)
>     2. then a prompt string will show up so that user can interact
> with Clojure
>     3. built-in commands support is possible
>     4. prompt for user input is possible (I think this is the most
> import part that I want, but I don't know how I can make REPL prompts
> a user input...)
>     5. real Clojure form can be dispatch to REPL and the shell can
> show the result returned by REPL
>
> is there any project already on this, or is it possible to implement
> it in some kind of ways??
>
> Thanks,
> Jaime

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to