On Nov 24, 2008, at 1:49 PM, Michael Wood wrote:
> This looks great :)
Thanks!
> A couple of comments below:
>
> On Mon, Nov 24, 2008 at 6:57 PM, Stephen C. Gilardi
> <[EMAIL PROTECTED]> wrote:
> [...]
>> Here are some examples of using the proposed clojure.main via "java -
>> jar clojure.jar":
>>
>> Display usage info:
>>
>> % java -jar clojure.jar --help
>> Usage: java -jar clojure.jar [option*] [file-arg*] [--] [arg*]
>
> Perhaps this should be:
>
> Usage: java -jar clojure.jar [option*] [file-arg* [-- [arg*]]]
>
> or does it make sense to allow args without file-args?
It does make sense to allow args without file-args. However, -- is
necessary if and only if you're including args, so I think this is
correct (please check me on that):
Usage: java -jar clojure.jar [option*] [file-arg*] [-- arg*]
>> Combining eval and repl, demonstrating that the repl can load files
>> and see arguments:
>>
>> % java -jar clojure.jar -e "\"welcome to the repl\"" --repl
>> init.clj
>> -- 1 2 :a :b
>> welcome to the repl
>> hi from init.clj, arguments are ("1" "2" ":a" ":b")
>> Clojure
>
> This "Clojure" seems out of place. I wonder if it would make sense to
> suppress it if the repl is loading stuff, or if "-e" is used?
It's there due to "--repl". I use an init.clj all the time to set up
things like *print-length* that can't be set up in user.clj. I suppose
I could put whatever greeting I wanted there if a "repl that loads
files" didn't print Clojure. I'm inclined to leave it in for now
pending more feedback.
>> Now using a filename, files to load before it, and arguments
>>
>> % java -jar clojure.jar script.clj init.clj init2.clj -- a b c
>> hi from init.clj, arguments are ("a" "b" "c")
>> hi from init2.clj, arguments are ("a" "b" "c")
>> hi from script.clj, arguments are ("a" "b" "c")
> I think this could just as well load all the files in the order they
> appear on the command line. It seems easier to me to explain "the
> files are loaded in order" rather than "the files listed after the
> first file are loaded in order, followed by the first file."
>
I'm thinking of it as being nice to specify a main script first and
the rest satisfying dependencies or setting up an environment. The
current way treats file-args as a kind of args to the script, ones
that cause loading files rather than binding for use.
>> Executing Clojure code piped into standard in:
>>
>> % echo "(prn (sort '(:a :z :m :q)))" | java -jar clojure.jar -
>> (:a :m :q :z)
>
> Could you supply command line args here? If so, I suppose you can
> ignore my comment about the Usage.
You can, and I think the new usage works. Thanks for the feedback,
I'll make that change!
--Steve
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---