On Jan 27, 2012, at 11:32 AM, Keshav Kini wrote: > On Fri, Jan 27, 2012 at 18:26, David Roe <r...@math.harvard.edu> wrote: >> We're working on rewriting the doctest framework only. So we're still >> just sticking to hyphens, but are making them UNIX-compliant: --gdb >> instead of -gdb for example. My first impression of your proposal is >> that I like it, though there are some ambiguities in the syntax: in >> mercurial the subcommand is required, whereas in sage we would also >> want to allow "sage ARGS". So you have to be careful what you mean by >> "sage test": are you running sage on a file called test, or are you >> running the subcommand test with no arguments. > > I mentioned this elsewhere in the thread, but I think we can use "--" > as an escaper of sorts. (git does this, for example). So `sage test` > would run the subcommand "test" with no arguments, and `sage -- test` > would run a sage script in a file called "test".
This is a standard part of the getopt C library which I imagine python uses, or at least mimics. It is something that should be mentioned in the documentation though for people who aren't familiar with it. I'm a big fan of the subcommand syntax and using standard option parsing, so I give the proposal a +1, though I think that we need to support the old syntax for a while. There are almost certainly scripts that will have to support both old and new versions during a transition period. I'm thinking in particular of the Mac app which has some scripts and would otherwise lose the ability to run old versions of Sage. Also, the last time we talked about this people wanted to keep some commands out of python since it made things slower. IIRC it was commands like --gap and --gp that start interactive shells. I don't know if feelings have changed since then. -Ivan -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org