bugfix for mkscript.cl
Jason Quinn wrote on Apr 28, 2008
The mkscript task always assumes by default that the user wants to add another task despite having a "more" parameter that the user can set.
The relevant portion of code is
I think deleting the "more=YES" line restores proper behavior. I couldn't think of a reason why it might have been hard-coded to YES on purpose.
Jason
The relevant portion of code is
# Ask if more commands are to be added to the script.
more = YES
if (!more)
break
I think deleting the "more=YES" line restores proper behavior. I couldn't think of a reason why it might have been hard-coded to YES on purpose.
Jason
Francisco Valdes wrote on Apr 28, 2008
You almost got me on that one :oops: when I took the statement out and then realized the reason. The reason it is there is to reset the default for the query parameter before the parameter is referenced, which results in a user query. So in a loop, if the value was "no" from a previous run, the user will get the prompt
So this is actually a correct bit of IRAF code though mighty musty (1986).
Frank
Add another command? (yes):
So this is actually a correct bit of IRAF code though mighty musty (1986).
Frank
Jason Quinn wrote on Apr 28, 2008
valdes
You almost got me on that one :oops: when I took the statement out and then realized the reason. The reason it is there is to reset the default for the query parameter before the parameter is referenced, which results in a user query. So in a loop, if the value was "no" from a previous run, the user will get the prompt
For me the task always prompts for the "more" parameter regardless if the "more=YES" line is commented or uncommented (the only exception is if a "more=yes" or "more=no" is explicitly given on the command line). The user always gets a query. It's just a matter if the very first prompt's default answer will be "no" from the previous run, which from my perspective is the lesser of two evils because we gain the proper behavior when the task's "more" parameter is set by epar. Personally, I think this trumps having the task always assume the user wants to add more tasks. I suppose this is somewhat a matter of taste. I tend not to add more than one task in mkscript because I build my longer scripts up one at a time in a proper text editor; so having the task remember "no" from the last run is nice because I probably don't want to add more tasks. Without the "more=YES" line, if I do happen to say "yes" the task then "adapts" by assuming I want to add more. In summary, I don't think it's such a bad thing if the task prompts with
Add another command? (no):
Hopefully I understood your post correctly. I was a little uncertain what the "so in a loop" part meant. Did you mean actually command line loops like for and while or script loops? Do you know if people use mkscript within those?
Cheers,
Jason
Last post on Apr 28, 2008