#21: command line option parsing
---------------------------+------------------------------------------------
Reporter: was | Owner: mabshoff
Type: enhancement | Status: needs_review
Priority: minor | Milestone: sage-4.3.4
Component: interfaces | Keywords:
Author: | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
---------------------------+------------------------------------------------
Changes (by jhpalmieri):
* status: new => needs_review
Comment:
Here are patches. After applying "trac_21-scripts.patch", you may need to
make "SAGE_ROOT/local/bin/sage-sage.py" executable. The build process
works for me with these patches. For the standard packages, the third
line in
{{{
if [ "$SAGE_LOCAL" = "" ]; then
echo "SAGE_LOCAL undefined ... exiting";
echo "Maybe run 'sage -sh'?"
exit 1
fi
}}}
should be changed to "Maybe run 'sage --sh'?", but this doesn't affect the
functioning of the packages, and otherwise, they don't need changing. I
haven't looked at optional packages.
This approaches uses Python's optparse to parse command-line options. If
someone wants to write a version using [http://code.google.com/p/shflags/
shflags] or some other package, go ahead.
I propose the following approach, whether using these patches or other
ones:
- first, we include new command-line options but don't turn them on by
default, instead printing a message like this one when you type "sage
[...]" with a nonempty argument:
{{{
Note: Using old-style Sage command-line options.
To try out Sage's experimental GNU/Posix-style command-line options
(for example, 'sage --notebook' instead of 'sage -notebook'), set the
environment variable $SAGE_NEW_OPTIONS to something nonempty.
To bypass this message, set the environment variable
$SAGE_SKIP_OPTIONS_MESSAGE to something nonempty.
}}}
Running "sage" (with no arguments) would not trigger this message.
(Perhaps we could only turn this on in prerelease (alpha and rc) versions?
Alternatively, a change like this could go with the version 5.0 release.)
- after a while, we switch this to
{{{
Warning: Using old-style Sage command-line options.
Sage is changing to use conventional GNU/Posix-style command-line
options
(for example, 'sage --notebook instead of 'sage -notebook). This
change will
become the default soon. Meanwhile, to use this new style (and
therefore
to avoid seeing this message), set the environment variable
$SAGE_NEW_OPTIONS to something nonempty.
}}}
perhaps with no easy way of disabling this message while using old-style
options.
- finally, we turn on the new options, perhaps with an environment
variable $SAGE_OLD_OPTIONS to use the old ones, with the understanding
that any changes in command-line options may not be maintained for the old
version.
See [http://groups.google.com/group/sage-
devel/browse_thread/thread/de30143ec073f31?tvc=2 sage-devel] for some
discussion.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/21#comment:8>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" 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/sage-trac?hl=en.