implement graceful cancellation of long-running CLI operations

.