chore: 累积更新
This commit is contained in:
@@ -101,7 +101,6 @@ def _do_switch(
|
|||||||
|
|
||||||
|
|
||||||
@click.group("provider", invoke_without_command=True)
|
@click.group("provider", invoke_without_command=True)
|
||||||
@click.argument("provider_id", required=False)
|
|
||||||
@click.option("--key", help="API key (scripting only; appears in shell history)")
|
@click.option("--key", help="API key (scripting only; appears in shell history)")
|
||||||
@click.option("--model", help="Override the default model")
|
@click.option("--model", help="Override the default model")
|
||||||
@click.option("--base-url", help="Override the provider base URL")
|
@click.option("--base-url", help="Override the provider base URL")
|
||||||
@@ -109,7 +108,6 @@ def _do_switch(
|
|||||||
@click.pass_context
|
@click.pass_context
|
||||||
def provider_cmd(
|
def provider_cmd(
|
||||||
ctx: click.Context,
|
ctx: click.Context,
|
||||||
provider_id: str | None,
|
|
||||||
key: str | None,
|
key: str | None,
|
||||||
model: str | None,
|
model: str | None,
|
||||||
base_url: str | None,
|
base_url: str | None,
|
||||||
@@ -125,10 +123,20 @@ def provider_cmd(
|
|||||||
if ctx.invoked_subcommand is not None:
|
if ctx.invoked_subcommand is not None:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Use ctx.args (positional args left after option parsing) to avoid
|
||||||
|
# Click's argument consuming subcommand names like "list"/"current".
|
||||||
|
provider_id: str | None = ctx.args[0] if ctx.args else None
|
||||||
|
|
||||||
if not provider_id:
|
if not provider_id:
|
||||||
provider_list_table()
|
provider_list_table()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Reject stray positional args — only one provider_id is meaningful.
|
||||||
|
if len(ctx.args) > 1:
|
||||||
|
raise click.ClickException(
|
||||||
|
f"Unexpected extra argument(s): {' '.join(ctx.args[1:])}"
|
||||||
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
provider = get_provider(provider_id)
|
provider = get_provider(provider_id)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
|||||||
Reference in New Issue
Block a user