Good point. I think I need to find out how to make the "shell" prompt for user input, e.g. when the user log into a system, the shell will prompt to ask for a password....
On Sep 20, 4:03 pm, Sanel Zukan <san...@gmail.com> wrote: > 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 <xiejianm...@gmail.com> 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 clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en