diff --git a/src/click/core.py b/src/click/core.py index 6f483675d..93c2d177c 100644 --- a/src/click/core.py +++ b/src/click/core.py @@ -1180,7 +1180,7 @@ def get_help_option_names(self, ctx: Context) -> list[str]: for param in self.params: all_names.difference_update(param.opts) all_names.difference_update(param.secondary_opts) - return list(all_names) + return sorted(all_names) def get_help_option(self, ctx: Context) -> Option | None: """Returns the help option object.