Skip to content

Commit 49e77da

Browse files
stroxlerfacebook-github-bot
authored andcommitted
Use a callback in the pyre servers command
Reviewed By: shannonzhu Differential Revision: D35766678 fbshipit-source-id: 989d567bcd4d61db4e6e5bf5b7b09df9bc1b5270
1 parent 842d8a3 commit 49e77da

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

client/pyre.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -922,15 +922,30 @@ def restart(
922922
invoke_without_command=True,
923923
)
924924
@click.pass_context
925-
def servers(context: click.Context) -> int:
925+
def servers(context: click.Context) -> None:
926926
"""
927927
Commands to manipulate multiple Pyre servers.
928928
"""
929+
pass
930+
931+
932+
@servers.result_callback()
933+
@click.pass_context
934+
def run_default_servers_command(
935+
context: click.Context,
936+
value: Optional[commands.ExitCode],
937+
*args: object,
938+
**kwargs: object,
939+
) -> commands.ExitCode:
929940
if context.invoked_subcommand is None:
930941
arguments: command_arguments.CommandArguments = context.obj["arguments"]
931942
return commands.servers.run_list(arguments.output)
932-
# This return value is not used anywhere.
933-
return commands.ExitCode.SUCCESS
943+
elif value is not None:
944+
return value
945+
else:
946+
raise commands.ClientException(
947+
"Non-default serevers subcommand did not return a value"
948+
)
934949

935950

936951
@servers.command(name="list")

0 commit comments

Comments
 (0)