@@ -114,7 +114,7 @@ class Alconna(Subcommand, Generic[TDC]):
114
114
115
115
def compile (self , compiler : TCompile | None = None , param_ids : set [str ] | None = None ) -> Analyser [TDC ]:
116
116
"""编译 `Alconna` 为对应的解析器"""
117
- return Analyser (self , compiler ).compile (param_ids )
117
+ return Analyser (self , compiler ).compile (set () if param_ids is None else param_ids )
118
118
119
119
def __init__ (
120
120
self ,
@@ -164,6 +164,7 @@ def __init__(
164
164
_args = sum ((i for i in args if isinstance (i , (Args , Arg ))), Args ())
165
165
super ().__init__ ("ALCONNA::" , _args , * options , dest = name , separators = separators or ns_config .separators , help_text = self .meta .description ) # noqa: E501
166
166
self .name = name
167
+ self .aliases = frozenset ((name ,))
167
168
self .behaviors = []
168
169
for behavior in behaviors or []:
169
170
self .behaviors .extend (requirement_handler (behavior ))
@@ -189,7 +190,11 @@ def reset_namespace(self, namespace: Namespace | str, header: bool = True) -> Se
189
190
self .path = f"{ self .namespace } ::{ self .name } "
190
191
if header :
191
192
self .prefixes = namespace .prefixes .copy ()
192
- self .options = self .options [:- 3 ]
193
+ name = f"{ self .command or self .prefixes [0 ]} " # type: ignore
194
+ self .dest = name
195
+ self .path = f"{ self .namespace } ::{ name } "
196
+ self .aliases = frozenset ((name ,))
197
+ self .options = [opt for opt in self .options if not isinstance (opt , (Help , Completion , Shortcut ))]
193
198
add_builtin_options (self .options , namespace )
194
199
self .meta .fuzzy_match = namespace .fuzzy_match or self .meta .fuzzy_match
195
200
self .meta .raise_exception = namespace .raise_exception or self .meta .raise_exception
@@ -310,7 +315,7 @@ def add(self, opt: Option | Subcommand) -> Self:
310
315
Self: 命令本身
311
316
"""
312
317
with command_manager .update (self ):
313
- self .options .insert ( - 3 , opt )
318
+ self .options .append ( opt )
314
319
return self
315
320
316
321
@init_spec (Option , is_method = True )
0 commit comments