Repository: feast-dev/feast

Issue:
feast cli minor bug
## Expected Behavior 

`feast teardown --help` should list the options to this subcommand like

> (feast) ➜  examples git:(br_jsd_mlflow_feast_example) ✗ feast init --help
> Usage: feast init [OPTIONS] [PROJECT_DIRECTORY]
> 
>   Create a new Feast repository
> 
> Options:
>   -m, --minimal               Create an empty project repository
>   -t, --template [local|gcp]  Specify a template for the created project
>   --help                      Show this message and exit.

## Current Behavior

> (base) ➜  delta-lake git:(master) ✗ feast teardown --help
> Usage: feast teardown [OPTIONS]
> 
>   Tear down deployed feature store infrastructure
> 
> Options:
>   --help  Show this message and exit.

I reckon this is a generic message if the subcommand has not options. For example, `feast apply --help` exhibits similar 
behavior.

## Steps to reproduce

`feast teardown --help`

### Specifications

- Version: 0.10.3
- Platform: MacOS Mojave
- Subsystem:




Discussion:
Thanks @dmatrix. Definitely a few rough edges around the new CLI. Let's keep this issue open until resolved!
@dmatrix I'd like to fix this. What exactly should the `feast teardown --help` and `feast apply --help` print ?
@tedhtchang Generally speaking, most usage messages would print out options if available. For example, the
`feast init --help` will print out: 

> (base) ➜  delta-lake git:(master) ✗ feast init --help
> Usage: feast init [OPTIONS] [PROJECT_DIRECTORY]
> 
>   Create a new Feast repository
> 
> Options:
>   -m, --minimal               Create an empty project repository
>   -t, --template [local|gcp]  Specify a template for the created project
>   --help                      Show this message and exit.

If no options exist for a subcommand, then it's not unreasonable to indicate none exists, IMHO. For example, one can
envision something such as:

> Usage: feast teardown [OPTIONS]
> 
>   Tear down deployed feature store infrastructure
> 
> Options:(No current command options)
>   --help  Show this message and exit.

The best place to start would be [here]( https://github.com/feast-dev/feast/blob/master/sdk/python/feast/cli.py#L168).

cc: @woop can recommend or opine on what should the message be or what should it indicate.
Currently we don't have options for this command (teardown and apply), so following @dmatrix's second recommendation may make sense.

Resolving patch:
diff --git a/sdk/python/feast/cli.py b/sdk/python/feast/cli.py
--- a/sdk/python/feast/cli.py
+++ b/sdk/python/feast/cli.py
@@ -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",
@@ -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):
     """
@@ -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):
     """


Test patch: