File tree 2 files changed +10
-2
lines changed
src/arclet/alconna/_internal
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ class User:
8
8
name : str
9
9
age : int
10
10
11
+
11
12
user_ = Alconna (
12
13
"user" ,
13
14
Option ("list" ),
@@ -26,6 +27,7 @@ class User:
26
27
27
28
users = {}
28
29
30
+
29
31
def handle (send : str ):
30
32
res = user_ .parse (send )
31
33
if not res .matched :
Original file line number Diff line number Diff line change @@ -226,7 +226,11 @@ def analyse(self, argv: Argv[TDC]) -> Self:
226
226
if self .default_main_only and not self .args_result :
227
227
self .args_result = analyse_args (argv , self .self_args )
228
228
if not self .args_result and self .need_main_args :
229
- raise ArgumentMissing (lang .require ("subcommand" , "args_missing" ).format (name = self .command .dest ))
229
+ raise ArgumentMissing (
230
+ self .self_args .argument [0 ].field .get_missing_tips (
231
+ lang .require ("subcommand" , "args_missing" ).format (name = self .command .dest )
232
+ )
233
+ )
230
234
return self
231
235
232
236
def get_sub_analyser (self , target : Subcommand ) -> SubAnalyser [TDC ] | None :
@@ -384,7 +388,9 @@ def process(self, argv: Argv[TDC]) -> Arparma[TDC]:
384
388
return handle_completion (self , argv , rest [- 2 ])
385
389
exc = ParamsUnmatched (lang .require ("analyser" , "param_unmatched" ).format (target = argv .next (move = False )[0 ]))
386
390
else :
387
- exc = ArgumentMissing (lang .require ("analyser" , "param_missing" ))
391
+ exc = ArgumentMissing (
392
+ self .self_args .argument [0 ].field .get_missing_tips (lang .require ("analyser" , "param_missing" ))
393
+ )
388
394
if comp_ctx .get (None ) and isinstance (exc , ArgumentMissing ):
389
395
raise PauseTriggered (prompt (self , argv ), exc , argv )
390
396
if self .command .meta .raise_exception :
You can’t perform that action at this time.
0 commit comments