Skip to content

Commit 81fe6de

Browse files
committed
Fix: select_argument.py
1 parent 64cbfa9 commit 81fe6de

File tree

3 files changed

+28
-39
lines changed

3 files changed

+28
-39
lines changed
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
from cmdcomp.v2.command.argument.command_argument import V2CommandArgument
22
from cmdcomp.v2.command.argument.file_argument import V2FileArgument
33
from cmdcomp.v2.command.argument.flag_argument import V2FlagArgument
4-
from cmdcomp.v2.command.argument.relay_argument import V2RelayArgument
54
from cmdcomp.v2.command.argument.select_argument import V2SelectArgument
65

7-
V2Argument = (
8-
V2SelectArgument
9-
| V2FileArgument
10-
| V2CommandArgument
11-
| V2FlagArgument
12-
| V2RelayArgument
13-
)
6+
V2Argument = V2SelectArgument | V2FileArgument | V2CommandArgument | V2FlagArgument

cmdcomp/v2/command/argument/relay_argument.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

cmdcomp/v2/command/argument/select_argument.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,30 @@ class V2SelectArgument(HasAlias, Model):
2424
Field(title="alias of the argument."),
2525
] = None
2626

27-
options: Annotated[
28-
list[str],
29-
Field(title="completion candidates."),
30-
]
27+
raw_options: Annotated[
28+
list[str] | None,
29+
Field(
30+
title="completion candidates.",
31+
alias="options",
32+
),
33+
] = None
34+
35+
values: Annotated[
36+
list[str] | str | None,
37+
Field(
38+
title="completion candidates.",
39+
description="this field is deprecated. use `options` instead.",
40+
json_schema_extra={"deprecated": True},
41+
),
42+
] = None
43+
44+
@property
45+
def options(self) -> list[str]:
46+
if self.raw_options is not None:
47+
return self.raw_options
48+
if self.values is None:
49+
return []
50+
elif isinstance(self.values, str):
51+
return [self.values]
52+
else:
53+
return self.values

0 commit comments

Comments
 (0)