Skip to content

Commit be7bceb

Browse files
committed
Update: classname.
1 parent a46b3bf commit be7bceb

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

cmdcomp/completion.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Candidates,
88
Command,
99
Completions,
10-
StrOptionsCommand,
10+
SubCommandsCommand,
1111
get_candidates,
1212
get_targets,
1313
)
@@ -49,7 +49,7 @@ def _update_completions_list(
4949
if keys is None:
5050
keys = []
5151

52-
if not isinstance(command, StrOptionsCommand):
52+
if not isinstance(command, SubCommandsCommand):
5353
return
5454

5555
for name, subcommand in command.subcommands.items():

cmdcomp/config/command/command.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
Completions = Candidates | dict[str, "Completions"] # type: ignore
2424

2525

26-
class StrOptionsCommand(Model):
26+
class SubCommandsCommand(Model):
27+
"""A command that can specify a subcommand."""
28+
2729
model_config = ConfigDict(arbitrary_types_allowed=True)
2830

2931
alias: Annotated[
@@ -56,6 +58,8 @@ def aliases(self) -> list[str]:
5658

5759

5860
class SpecificOptionsCommand(Model):
61+
"""A command that can specify options."""
62+
5963
model_config = ConfigDict(arbitrary_types_allowed=True)
6064

6165
alias: Annotated[
@@ -81,7 +85,7 @@ def aliases(self) -> list[str]:
8185
return self.alias
8286

8387

84-
Command = StrOptionsCommand | SpecificOptionsCommand
88+
Command = SubCommandsCommand | SpecificOptionsCommand
8589

8690
Subcommands = OrderedDict[SubcommandName, Command]
8791

@@ -92,7 +96,7 @@ def get_targets(name: SubcommandName, subcommand: Command) -> list[str]:
9296

9397
def get_candidates(command: Command) -> Candidates:
9498
match command:
95-
case StrOptionsCommand():
99+
case SubCommandsCommand():
96100
return (
97101
[command.options]
98102
if isinstance(command.options, str)

docs/config.schema.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
},
7373
"SpecificOptionsCommand": {
7474
"additionalProperties": false,
75+
"description": "A command that can specify options.",
7576
"properties": {
7677
"alias": {
7778
"anyOf": [
@@ -105,8 +106,9 @@
105106
"title": "SpecificOptionsCommand",
106107
"type": "object"
107108
},
108-
"StrOptionsCommand": {
109+
"SubCommandsCommand": {
109110
"additionalProperties": false,
111+
"description": "A command that can specify a subcommand.",
110112
"properties": {
111113
"alias": {
112114
"anyOf": [
@@ -140,7 +142,7 @@
140142
"additionalProperties": {
141143
"anyOf": [
142144
{
143-
"$ref": "#/$defs/StrOptionsCommand"
145+
"$ref": "#/$defs/SubCommandsCommand"
144146
},
145147
{
146148
"$ref": "#/$defs/SpecificOptionsCommand"
@@ -151,7 +153,7 @@
151153
"type": "object"
152154
}
153155
},
154-
"title": "StrOptionsCommand",
156+
"title": "SubCommandsCommand",
155157
"type": "object"
156158
}
157159
},
@@ -167,7 +169,7 @@
167169
"root": {
168170
"anyOf": [
169171
{
170-
"$ref": "#/$defs/StrOptionsCommand"
172+
"$ref": "#/$defs/SubCommandsCommand"
171173
},
172174
{
173175
"$ref": "#/$defs/SpecificOptionsCommand"

0 commit comments

Comments
 (0)