|
13 | 13 | from .exceptions import ClickException |
14 | 14 | from .exceptions import Exit |
15 | 15 | from .exceptions import MissingParameter |
| 16 | +from .exceptions import NoArgsIsHelpError |
16 | 17 | from .exceptions import UsageError |
17 | 18 | from .formatting import HelpFormatter |
18 | 19 | from .formatting import join_options |
@@ -1135,8 +1136,7 @@ def format_epilog(self, ctx, formatter): |
1135 | 1136 |
|
1136 | 1137 | def parse_args(self, ctx, args): |
1137 | 1138 | if not args and self.no_args_is_help and not ctx.resilient_parsing: |
1138 | | - echo(ctx.get_help(), color=ctx.color) |
1139 | | - ctx.exit() |
| 1139 | + raise NoArgsIsHelpError(ctx) |
1140 | 1140 |
|
1141 | 1141 | parser = self.make_parser(ctx) |
1142 | 1142 | opts, args, param_order = parser.parse_args(args=args) |
@@ -1303,8 +1303,7 @@ def format_commands(self, ctx, formatter): |
1303 | 1303 |
|
1304 | 1304 | def parse_args(self, ctx, args): |
1305 | 1305 | if not args and self.no_args_is_help and not ctx.resilient_parsing: |
1306 | | - echo(ctx.get_help(), color=ctx.color) |
1307 | | - ctx.exit(code=1) |
| 1306 | + raise NoArgsIsHelpError(ctx) |
1308 | 1307 |
|
1309 | 1308 | rest = super().parse_args(ctx, args) |
1310 | 1309 |
|
|
0 commit comments