Skip to content

Commit 49a7545

Browse files
feat: [SNOW-988145] provide connection name as arg (#2528)
1 parent d16462e commit 49a7545

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/snowflake/cli/_plugins/connection/commands.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,9 @@ def add(
319319
)
320320

321321

322-
@app.command()
322+
@app.command(requires_connection=False)
323323
def remove(
324-
connection_name: str = typer.Option(
325-
None,
326-
"--connection-name",
327-
"-n",
324+
connection_name: str = typer.Argument(
328325
help="Name of the connection to remove.",
329326
show_default=False,
330327
),

tests/__snapshots__/test_help_messages.ambr

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5129,14 +5129,17 @@
51295129
# name: test_help_messages[connection.remove]
51305130
'''
51315131

5132-
Usage: root connection remove [OPTIONS]
5132+
Usage: root connection remove [OPTIONS] CONNECTION_NAME
51335133

51345134
Removes a connection from configuration file.
51355135

51365136

5137+
+- Arguments ------------------------------------------------------------------+
5138+
| * connection_name TEXT Name of the connection to remove. |
5139+
| [required] |
5140+
+------------------------------------------------------------------------------+
51375141
+- Options --------------------------------------------------------------------+
5138-
| --connection-name -n TEXT Name of the connection to remove. |
5139-
| --help -h Show this message and exit. |
5142+
| --help -h Show this message and exit. |
51405143
+------------------------------------------------------------------------------+
51415144
+- Global configuration -------------------------------------------------------+
51425145
| --format [TABLE|JSON|JSON_EXT| Specifies the output |

tests/test_connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1776,7 +1776,7 @@ def _add_connection(runner, tmp_file, name, is_default=False, expected_to_fail=F
17761776

17771777
def _remove_connection(runner, tmp_file, name, expected_to_fail=False):
17781778
result = runner.invoke_with_config_file(
1779-
tmp_file.name, ["connection", "remove", "--connection-name", name]
1779+
tmp_file.name, ["connection", "remove", name]
17801780
)
17811781
if expected_to_fail:
17821782
assert result.exit_code != 0, result.output

0 commit comments

Comments
 (0)