cli: Define common methods for locking in `cli.Application`
There seem to be common patterns among many of the cli.Application
classes where the subcommand name is repeated and announcements are
called in conventional ways.
Formalize these patterns as common lock
and lock_and_announce
methods of the base class and factor out the repetition.
Related MRs:
- !440 (merged) (This MR)
- !436 (merged)
- master