Skip to content

Commit

Permalink
Merge pull request #99 from thiagofigueiro/issue-97-fix-subcommand-help
Browse files Browse the repository at this point in the history
Fix subcommand help
  • Loading branch information
thiagofigueiro authored Feb 8, 2020
2 parents 617731c + 7e757a7 commit d8b90ee
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
10 changes: 9 additions & 1 deletion src/nexuscli/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,15 @@ def _run_subcommand(arguments, subcommand):
print(__doc__)
sys.exit(errors.CliReturnCode.INVALID_SUBCOMMAND.value)

return subcommand_method(argv)
try:
return subcommand_method(argv)
except DocoptExit:
# Show help for the subcommand. The exception instance also has the
# the help but we can't use it because it won't have the `-h` details.
# This is because `-h` is handled by the first call to docopt, in main.
# FIXME: docopt is now more work than it's worth it
print(subcommand_module.__doc__)
return exception.CliReturnCode.SUBCOMMAND_ERROR.value


def main(argv=None):
Expand Down
2 changes: 0 additions & 2 deletions src/nexuscli/cli/subcommand_cleanup_policy.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
"""
Usage:
nexus3 cleanup_policy --help
nexus3 cleanup_policy create <policy_name> [--format=<format>]
[--downloaded=<days>] [--updated=<days>]
nexus3 cleanup_policy list
Options:
-h --help This screen
--format=<format> Accepted: all or a repository format [default: all]
--downloaded=<days> Cleanup criteria; last downloaded in this many days.
--updated=<days> Cleanup criteria; last updated in this many days.
Expand Down
4 changes: 1 addition & 3 deletions src/nexuscli/cli/subcommand_repository.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""
Usage:
nexus3 repository --help
nexus3 repository list
nexus3 repository show <repo_name>
nexus3 repository (delete|del) <repo_name> [--force]
Expand Down Expand Up @@ -49,8 +48,7 @@
[--https_port=<https_port>]
Options:
-h --help This screen # noqa: E501
--blob=<store_name> Use this blob with new repository [default: default]
--blob=<store_name> Use this blob with new repository [default: default] # noqa: E501
--depth=<repo_depth> Depth (0-5) where repodata folder(s) exist [default: 0]
--layout=<l_policy> Accepted: strict, permissive [default: strict]
--strict-content Enable strict content type validation
Expand Down
2 changes: 0 additions & 2 deletions src/nexuscli/cli/subcommand_script.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
"""
Usage:
nexus3 script --help
nexus3 script create <script_name> <script_path> [--script_type=<type>]
nexus3 script list
nexus3 script run <script_name> [<script_args>]
nexus3 script (delete|del) <script_name>
Options:
-h --help This screen
--script_type=<type> Script type [default: groovy]
Commands:
Expand Down

0 comments on commit d8b90ee

Please sign in to comment.