cobra
cobra copied to clipboard
OnKillRun feature
A helper to run a function if a command is killed.
Cool idea @decanus ! I haven't tried it out yet but it looks useful. This will need some tests and documentation. cc @jpmcb
This is a good idea...we had to implement this outside of cobra (which is fine.) But I think this establishes a good practice that all CLI's should have OOB. Some lint issues to clean up, at a quick glance it should be safe to annotate out SA1017
. Not sure about the others...
@decanus Sorry for the delay. Can you rebase this to make CI pass?
@marckhouzam done!
I was thinking about how this new feature would be used. I like the fact that the OnKillRun
can be defined for a specific command. But what if I wanted to create a global OnKillRun
for all the commands? For example to always intercept ^C
?
Would that be a likely scenario?
@decanus Are you still interested in getting this merged?
found this through google - would be nice to get this finished and merged, but i guess for now i'll have to roll my own signal handler
I'm still interested in merging this @decanus but CI is failing. Also, a very small doc and test would be important.