Skip to content

Commit 902bcd0

Browse files
committed
Update: support v2.
1 parent 8cba8ab commit 902bcd0

File tree

10 files changed

+508
-543
lines changed

10 files changed

+508
-543
lines changed

.vscode/settings.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@
3737
"python.linting.pylintEnabled": false,
3838
"python.testing.pytestEnabled": true,
3939
"yaml.schemas": {
40-
"docs/config.schema.json": "samples/v1/**/*.yaml",
41-
"docs/v2_config.schema.json": "samples/v2/**/*.yaml",
40+
"docs/config.schema.json": "samples/**/*.yaml",
4241
},
4342
"[python]": {
4443
"editor.codeActionsOnSave": {

cmdcomp/completion.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
from cmdcomp.shell import ShellType
44
from cmdcomp.v1.completion import generate_v1
55
from cmdcomp.v1.config import V1Config
6+
from cmdcomp.v2.completion import generate_v2
7+
from cmdcomp.v2.config import V2Config
68

79

810
def generate(shell: ShellType, config: Config) -> str:
911
match config.root:
1012
case V1Config():
1113
return generate_v1(shell, config.root)
1214

13-
# TODO: V2Config is still in draft.
14-
#
15-
# case V2Config():
16-
# return generate_v2(shell, config.root)
15+
case V2Config():
16+
return generate_v2(shell, config.root)
1717

1818
case _:
1919
raise NeverReach(config.root)

cmdcomp/config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
from pydantic import RootModel
88

99
from cmdcomp.v1.config import V1Config
10+
from cmdcomp.v2.config import V2Config
1011

1112

1213
class Config(RootModel):
1314
"""cmdcomp config."""
1415

15-
root: V1Config
16+
root: V1Config | V2Config
1617

1718

1819
def load(file: BinaryIO) -> Config:

cmdcomp/v2/__init__.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +0,0 @@
1-
"""
2-
Version 2 of the config module.
3-
4-
It's a draft.
5-
6-
Upgrade Plan.
7-
8-
- Support Keywords and positional arguments.
9-
10-
"""

0 commit comments

Comments
 (0)