Re: configurable bash script to launch Clojure available

2009-01-16 Thread Stephen C. Gilardi
On Jan 16, 2009, at 7:36 PM, Timothy Pratley wrote: I guess another way would be to just rebind *command-line-script* to nil on subsequent loads? It doesn't feel like an complete solution but I believe it covers the use cases discussed so far. That could work, but I think this kind of mechani

Re: configurable bash script to launch Clojure available

2009-01-16 Thread Timothy Pratley
I guess another way would be to just rebind *command-line-script* to nil on subsequent loads? It doesn't feel like an complete solution but I believe it covers the use cases discussed so far. --~--~-~--~~~---~--~~ You received this message because you are subscribe

Re: configurable bash script to launch Clojure available

2009-01-16 Thread Stephen C. Gilardi
On Jan 16, 2009, at 11:37 AM, Chouser wrote: It would also be useful for a .clj file to be able to determine if itself is the main script or if instead it's being loaded some other way (-i, load-file, require, etc.). How about this which is not quite the same, but has nice properties of its

Re: configurable bash script to launch Clojure available

2009-01-16 Thread Chouser
On Fri, Jan 16, 2009 at 11:27 AM, Stephen C. Gilardi wrote: > > [1] When clojure.main runs a script, it will set *command-line-script* to > the script name as it appears on the command line. > > Example: > >java -cp clojure.jar clojure.main -i dir-utils.clj list-dir.clj > :verbose :depth

Re: configurable bash script to launch Clojure available

2009-01-16 Thread Stephen C. Gilardi
On Jan 16, 2009, at 8:37 AM, Stephen C. Gilardi wrote: I like this. I've also seen several requests for a way to know when code is running in a script which could be satisfied by this as well. For clarity, here's what I'm proposing based on recent discussion in this thread: [1] When cloj

Re: configurable bash script to launch Clojure available

2009-01-16 Thread Stephen C. Gilardi
On Jan 16, 2009, at 7:31 AM, lpetit wrote: Maybe for scripts a global var such as *script-name* could be set automatically ? I like this. I've also seen several requests for a way to know when code is running in a script which could be satisfied by this as well. This would be an easy cha

Re: configurable bash script to launch Clojure available

2009-01-16 Thread lpetit
On Jan 16, 9:06 am, Timothy Pratley wrote: > +1 (and a windows .bat file for the unwashed) + 1 too. > I strongly suggest that the script name needs to be retained in > *command-line-args*. > ie: clj myscript.clj 1 2 No, please don't, or it would not be coherent with the way java handles it. M

Re: configurable bash script to launch Clojure available

2009-01-16 Thread Timothy Pratley
+1 (and a windows .bat file for the unwashed) I strongly suggest that the script name needs to be retained in *command-line-args*. ie: clj myscript.clj 1 2 *command-line-args* should be ("myscript.clj" 1 2) not (1 2) which is the current behavior of your script with the current clojure.main $0 or

Re: configurable bash script to launch Clojure available

2009-01-15 Thread Phil Hagelberg
"Mark Volkmann" writes: > I think a script like this should be included with the Clojure > download. It's seems to me that everyone needs one and currently has > to write their own by copying example script code from the Getting > Started page. Strongly agree. If 1.0 is released without this it

Re: configurable bash script to launch Clojure available

2009-01-15 Thread Stephen C. Gilardi
On Jan 15, 2009, at 11:31 AM, Chouser wrote: I had a launch script (which I've now lost due to my own clumsiness) that defaulted to a repl if given no file options, and always loaded a .clojurerc.clj file before starting a repl (whether it was by default or specifically asked via -r). This all

Re: configurable bash script to launch Clojure available

2009-01-15 Thread Chouser
On Thu, Jan 15, 2009 at 11:45 AM, Konrad Hinsen wrote: > > If I understand correctly what you are looking for, it exists. Here > is my standard command line for starting Clojure: > > java -cp $HOME/.clojure/clojure.jar:$HOME/.clojure/clojure- > contrib.jar clojure.main -i $HOME/.clojure/repl-ini

Re: configurable bash script to launch Clojure available

2009-01-15 Thread Mark Volkmann
I think a script like this should be included with the Clojure download. It's seems to me that everyone needs one and currently has to write their own by copying example script code from the Getting Started page. Maybe we can't reach a concensus on everything the script should do, but providing a

Re: configurable bash script to launch Clojure available

2009-01-15 Thread Konrad Hinsen
On Jan 15, 2009, at 17:31, Chouser wrote: > I had a launch script (which I've now lost due to my own clumsiness) > that defaulted to a repl if given no file options, and always loaded a > .clojurerc.clj file before starting a repl (whether it was by default > or specifically asked via -r). This

Re: configurable bash script to launch Clojure available

2009-01-15 Thread Chouser
On Thu, Jan 15, 2009 at 8:58 AM, Stephen C. Gilardi wrote: > I've checked in a bash script for launching Clojure to > clojure-contrib/launchers/bash/clj-env-dir. I had a launch script (which I've now lost due to my own clumsiness) that defaulted to a repl if given no file options, and always loa

configurable bash script to launch Clojure available

2009-01-15 Thread Stephen C. Gilardi
I've checked in a bash script for launching Clojure to clojure-contrib/ launchers/bash/clj-env-dir. It's configured using environment variables (one required and several optional). It sets up the CLASSPATH for the Clojure instance it launches based on the contents of a directory. This is a m