|
From: | Daniel J Sebald |
Subject: | Re: eliminating start-up message for non-interactive sessions |
Date: | Wed, 21 Jan 2015 15:49:56 -0600 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16 |
On 01/21/2015 11:40 AM, John W. Eaton wrote:
On 01/21/2015 12:11 PM, Carnë Draug wrote:On 21 January 2015 at 01:38, Rik <address@hidden> wrote:Your suggestion made a lot of sense so I implemented it in this cset (http://hg.savannah.gnu.org/hgweb/octave/rev/6ba5f1ff041e). It still prints the start-up message if you use input redirection to feed Octave a script, but I don't think many people do that. It certainly handles the shebang case and the --eval CODE case.Hi Rik I was thinking of taking a different approach at this which covers the case of having the code sent to STDIN. Instead of disabling the display of the message when there is --eval or script file, only display the message for interactive sessions and change he value of interactive when there is a script and code to eval. Here it is (inlined because it is so simple)In the meantime, I checked in a separate patch in addition to Rik's that has the same effect: http://hg.savannah.gnu.org/hgweb/octave/rev/f3ac54ac2c6a In any case, I agree that we should also avoid the startup message unless we are interactive or forced interactive. And that reading input from a script file should probably not be considered an interactive session (unless that has some other consequence, like closing stdin and not allowing user interaction; I can't remember if that is the case). So if there is a cleaner solution than the combination of Rik's patch and mine, please go ahead and use it. jwe
Looking at the startup message, I wondered if maybe there should be an associated command, such as "intro()" or for that matter "copyright()". That would then be a class of information messages:
copyright() intro() version() warranty()I noticed that "warranty()" appears to have a typo and attached a diff file for the missing verb.
The warranty got me to wondering. Maybe it would be convenient to have a "make warranty" which runs a simple program that searches the source tree making sure that each file has a warranty notice, and matches that of some canonical warranty in the source tree somewhere. One could change the canonical version of the warranty, then run "make warranty" and all files would have, for example YYYY-2013 changed to YYYY-2015. It could be a C program compiled with "make" or even an Octave script used after Octave is compiled. So, if the warranty is to change with a new year or whatever, change the canonical version, run "make warranty", and then all the file changes will show up in Mercurial before committing the changes.
There would need to be some escape code in the canonical version for the original year, e.g., "Copyright (C) \yyyy-2013 John W. Eaton". Other than that, writing such a thing in script really isn't that difficult to do. A dangerous make step, perhaps, but generally only the maintainers would know about it and use it to modify the repository.
Dan
octave-warranty-djs2015jan21.diff
Description: Text document
[Prev in Thread] | Current Thread | [Next in Thread] |