Skip to content

Commit

Permalink
Use a callback in the pyre servers command
Browse files Browse the repository at this point in the history
Reviewed By: shannonzhu

Differential Revision: D35766678

fbshipit-source-id: 989d567bcd4d61db4e6e5bf5b7b09df9bc1b5270
  • Loading branch information
stroxler authored and facebook-github-bot committed Apr 20, 2022
1 parent 842d8a3 commit 49e77da
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions client/pyre.py
Original file line number Diff line number Diff line change
Expand Up @@ -922,15 +922,30 @@ def restart(
invoke_without_command=True,
)
@click.pass_context
def servers(context: click.Context) -> int:
def servers(context: click.Context) -> None:
"""
Commands to manipulate multiple Pyre servers.
"""
pass


@servers.result_callback()
@click.pass_context
def run_default_servers_command(
context: click.Context,
value: Optional[commands.ExitCode],
*args: object,
**kwargs: object,
) -> commands.ExitCode:
if context.invoked_subcommand is None:
arguments: command_arguments.CommandArguments = context.obj["arguments"]
return commands.servers.run_list(arguments.output)
# This return value is not used anywhere.
return commands.ExitCode.SUCCESS
elif value is not None:
return value
else:
raise commands.ClientException(
"Non-default serevers subcommand did not return a value"
)


@servers.command(name="list")
Expand Down

0 comments on commit 49e77da

Please sign in to comment.