-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLI: Ensure deprecation warnings are printed before any prompts
The `click.Command` has a `deprecated` attribute, which is a bool, that when set to `True` results in a printed deprecation warning on usage, and adaptions of the help page to indicate the command as deprecated. The `click.option` prompts are however invoked before that warning is printed. This can lead to users filling out all prompts before they are finally greeted with the deprecation message. Therefore we customize the `click.Command` class introducing `aiida.cmdline.groups.VerdiCommand` to move the printing logic to before the first prompt is shown. The `VerdiCommandGroup` sets `command_class` to this new custom class such that all `verdi` commands automatically use it. To deprecate a command, the `deprecated` argument now just has to be set to the desired deprecation message.
- Loading branch information
1 parent
23d2aa5
commit 048211c
Showing
6 changed files
with
75 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters