From c83a095966828a8a3cf0be93ae6a43465fafce9b Mon Sep 17 00:00:00 2001 From: fubuloubu <3859395+fubuloubu@users.noreply.github.com> Date: Thu, 11 Jul 2024 15:25:54 -0400 Subject: [PATCH] refactor: make sure that all commands are ordered by listing --- silverback/_cli.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/silverback/_cli.py b/silverback/_cli.py index 079f51b8..7e071a58 100644 --- a/silverback/_cli.py +++ b/silverback/_cli.py @@ -30,7 +30,13 @@ from silverback.runner import PollingRunner, WebsocketRunner -@click.group() +class OrderedCommands(click.Group): + # NOTE: Override so we get the list ordered by definition order + def list_commands(self, ctx: click.Context) -> list[str]: + return list(self.commands) + + +@click.group(cls=OrderedCommands) def cli(): """Work with Silverback applications in local context (using Ape).""" @@ -218,13 +224,7 @@ def get_client_from_profile(ctx, param, value) -> Client: ) -class PlatformCommands(click.Group): - # NOTE: Override so we get the list ordered by definition order - def list_commands(self, ctx: click.Context) -> list[str]: - return list(self.commands) - - -@cli.group(cls=PlatformCommands) +@cli.group(cls=OrderedCommands) def cluster(): """Connect to hosted application clusters"""