-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Snow 1272319 alias snowcli core object commands (#1067)
* move object stage command into separate plugin * stage commands * git commands * streamlit commands * snowpark commands * update snapshots * stage commands: remove printing default for required arguments * update release notes * fix ruff * refactor * change object commands to aliases in integration tests * fix help messages * Adjust scope option help message
- Loading branch information
1 parent
7d34b3f
commit 4dcf092
Showing
20 changed files
with
1,310 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
from __future__ import annotations | ||
|
||
from typing import Tuple | ||
|
||
import typer | ||
from snowflake.cli.api.commands.snow_typer import SnowTyper | ||
from snowflake.cli.api.constants import ObjectType | ||
from snowflake.cli.plugins.object.commands import ( | ||
describe, | ||
drop, | ||
list_, | ||
scope_option, # noqa: F401 | ||
) | ||
|
||
|
||
def add_object_command_aliases( | ||
app: SnowTyper, | ||
object_type: ObjectType, | ||
name_argument: typer.Argument, | ||
like_option: typer.Option, | ||
scope_option: typer.Option, | ||
): | ||
@app.command("list", requires_connection=True) | ||
def list_cmd( | ||
like: str = like_option, | ||
scope: Tuple[str, str] = scope_option, | ||
**options, | ||
): | ||
list_(object_type=object_type.value.cli_name, like=like, scope=scope, **options) | ||
|
||
list_cmd.__doc__ = f"Lists all available {object_type.value.sf_plural_name}." | ||
|
||
@app.command("drop", requires_connection=True) | ||
def drop_cmd(name: str = name_argument, **options): | ||
drop( | ||
object_type=object_type.value.cli_name, | ||
object_name=name, | ||
**options, | ||
) | ||
|
||
drop_cmd.__doc__ = f"Drops {object_type.value.sf_name} with given name." | ||
|
||
@app.command("describe", requires_connection=True) | ||
def describe_cmd(name: str = name_argument, **options): | ||
describe( | ||
object_type=object_type.value.cli_name, | ||
object_name=name, | ||
**options, | ||
) | ||
|
||
describe_cmd.__doc__ = f"Provides description of {object_type.value.sf_name}." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# TODO 3.0: remove this file |
File renamed without changes.
20 changes: 20 additions & 0 deletions
20
src/snowflake/cli/plugins/object_stage_deprecated/plugin_spec.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# TODO 3.0: remove this file | ||
|
||
from snowflake.cli.api.plugins.command import ( | ||
CommandPath, | ||
CommandSpec, | ||
CommandType, | ||
plugin_hook_impl, | ||
) | ||
from snowflake.cli.plugins.object_stage_deprecated.commands import ( | ||
app as stage_deprecated_app, | ||
) | ||
|
||
|
||
@plugin_hook_impl | ||
def command_spec(): | ||
return CommandSpec( | ||
parent_command_path=CommandPath(["object"]), | ||
command_type=CommandType.COMMAND_GROUP, | ||
typer_instance=stage_deprecated_app, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.