-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLI: do not except when
--help
is passed to sub command
The `rocrate add workflow --help` call would except because the `add` command group would attempt to instantiate a research object crate. But since no existing crate was defined through the `-c` option, the instantiation of the crate would except. There is no straightforward way in `click` to prevent the execution of group command code when `--help` is passed. Instead, we move the addition of the `-c/--crate-dir` option to those commands that actually need it. Code duplication is prevented by defining the option once, assigning it to `OPTION_CRATE_PATH` and using that decorator for each command that requires the option. This is a breaking change for the interface as the crate path should now no longer be specified directly after the main command but rather after the actual leaf command. So: rocrate -c some/ro-crate add workflow Now becomes rocrate add workflow -c some/ro-crate The advantage of this is that it doesn't enforce this option on all commands, even those that don't need it and it is probably more intuitive for the user to put the option closer to all other options.
- Loading branch information
Showing
2 changed files
with
113 additions
and
61 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