Skip to content

Commit

Permalink
Merge branch 'main' into mchok-SNOW-1039218-app-list-templates
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-mchok authored Mar 11, 2024
2 parents a108901 + 8e77e74 commit 4d2f2ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
15 changes: 9 additions & 6 deletions src/snowflake/cli/api/commands/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,6 @@ def _password_callback(value: str):
rich_help_panel=_CLI_BEHAVIOUR,
)

LikeOption = typer.Option(
"%%",
"--like",
"-l",
help='Regular expression for filtering objects by name. For example, `list --like "my%"` lists all objects that begin with “my”.',
)

# If IfExistsOption, IfNotExistsOption, or ReplaceOption are used with names other than those in CREATE_MODE_OPTION_NAMES,
# you must also override mutually_exclusive if you want to retain the validation that at most one of these flags is
Expand Down Expand Up @@ -337,6 +331,15 @@ def _password_callback(value: str):
)


def like_option(help_example: str):
return typer.Option(
"%%",
"--like",
"-l",
help=f"SQL LIKE pattern for filtering objects by name. For example, {help_example}.",
)


def experimental_option(
experimental_behaviour_description: Optional[str] = None,
) -> typer.Option:
Expand Down
9 changes: 3 additions & 6 deletions src/snowflake/cli/plugins/object/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import typer
from click import ClickException
from snowflake.cli.api.commands.flags import like_option
from snowflake.cli.api.commands.snow_typer import SnowTyper
from snowflake.cli.api.constants import SUPPORTED_OBJECTS, VALID_SCOPES
from snowflake.cli.api.output.types import QueryResult
Expand All @@ -23,12 +24,8 @@
help="Type of object. For example table, procedure, streamlit.",
case_sensitive=False,
)
LikeOption = typer.Option(
"%%",
"--like",
"-l",
help='SQL LIKE pattern for filtering objects by name. For example, `list function --like "my%"` lists '
"all functions that begin with “my”.",
LikeOption = like_option(
help_example='`list function --like "my%"` lists all functions that begin with “my”',
)


Expand Down

0 comments on commit 4d2f2ad

Please sign in to comment.