-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR#340 alternative ? flush -noconfirm .. exit exit_status -noconfirm #341
base: master
Are you sure you want to change the base?
PR#340 alternative ? flush -noconfirm .. exit exit_status -noconfirm #341
Conversation
Was looking to implement this feature and found it was already implemented but is a secret feature. Updated documentation and modified implementation so it is possible a user can discover the feature via usage such as "quit -help -invalid" like other commands.
Affecting process exit status.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using strncmp()
for testing each command argument forces the arguments to be in a specific order. The preferable method is to use an option structure with the Lookup()
routine, as is done for other commands with multiple options. Yes, I know I started the bad behavior. . .
@dlmiles Yup, I can confirm that the flush -noprompt does what I want. Thanks. It's a bit more finicky to use since I need to know that the -noprompt option is in the Magic version. Magic throws an error if I use -noprompt in a Magic version that does not have it, but with a "flush_all" script like the below it works fine. set values [ cellname list all ]
set mrev [lindex [lreverse [split [exec magic --version] "."]] 0 ]
foreach x $values {
if {${mrev} > 495} {
flush $x -noprompt
} else {
flush $x
}
} PS: I could not find the revision in any global tcl variable, nor was I able to redirect "version" to a variable, but I'm sure there is a more elegant way to do the above. |
@wulffern :
|
@RTimothyEdwards Did you want a revision using @wulffern maybe you can setup $ENV{'MAGIC_VERSION'} before magic is run, to TCL inherits envars, like in a startup wrapper shell script ? This way it is always available. This isn't much difference to how you are doing it now really. Maybe there should be a patch to make such a thing available from TCL an auto-populated variable. Maybe it can be run as Difficult to provide a backward compatible mechanism that isn't as finicky, as least you can make it into Your original patch with an environment variable set from inside (or maybe inherited from outside) might be better reworked with the Which then necessitates an option like |
@dlmiles : I approved it because the code is usable as-is, but if you can change it to use FYI: You can use the |
I have checked over the Lookup() methods and the usages in the codebase I can't quite see an obvious way all the requirements can be met :
Re current patch having fixed order, sure I added in a way that should not break any current users scripts and documentation indicates correct order to make it as easy to discover and get working as possible. |
@wulffern please advise, test as alternative to PR#340
Documented hidden/secret
exit [-noconfirm]
option to disable exit promptAdded
exit [exit_status]
option to send exit_status numberAdded
flush -noconfirm
option to disable flush promptI have tested the 'exit' patches.
I have not yet tested the 'flush' patch. Still comment back when testing complete on my side but would appreciate feedback if it closes your concern.