Skip to content

Commit

Permalink
Update default cli no option help message (#1550)
Browse files Browse the repository at this point in the history
Signed-off-by: ted chang <[email protected]>
  • Loading branch information
tedhtchang authored May 19, 2021
1 parent f050976 commit f2de613
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions sdk/python/feast/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@
DATETIME_ISO = "%Y-%m-%dT%H:%M:%s"


class NoOptionDefaultFormat(click.Command):
def format_options(self, ctx: click.Context, formatter: click.HelpFormatter):
"""Writes all the options into the formatter if they exist."""
opts = []
for param in self.get_params(ctx):
rv = param.get_help_record(ctx)
if rv is not None:
opts.append(rv)
if opts:
with formatter.section("Options(No current command options)"):
formatter.write_dl(opts)


@click.group()
@click.option(
"--chdir",
Expand Down Expand Up @@ -166,7 +179,7 @@ def feature_view_list(ctx: click.Context):
print(tabulate(table, headers=["NAME", "ENTITIES"], tablefmt="plain"))


@cli.command("apply")
@cli.command("apply", cls=NoOptionDefaultFormat)
@click.pass_context
def apply_total_command(ctx: click.Context):
"""
Expand All @@ -183,7 +196,7 @@ def apply_total_command(ctx: click.Context):
print(str(e))


@cli.command("teardown")
@cli.command("teardown", cls=NoOptionDefaultFormat)
@click.pass_context
def teardown_command(ctx: click.Context):
"""
Expand Down

0 comments on commit f2de613

Please sign in to comment.