File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
pydantic_argparse_next/parser Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -232,6 +232,17 @@ def show_help(self):
232
232
)
233
233
console .print (usage )
234
234
235
+ # Help help
236
+ text = ["--help (-H)" , "Show this message and exit." ]
237
+ table = Table (show_header = False , box = None )
238
+ table .add_row (* text )
239
+ panel = Panel (
240
+ table ,
241
+ title = None ,
242
+ border_style = "bold yellow"
243
+ )
244
+ console .print (panel )
245
+
235
246
# Arguments
236
247
def get_help_panel (x : list [Argument | KeywordArgument | Subcommand ], title : str | None ) -> Panel :
237
248
table = Table (show_header = False , box = None )
Original file line number Diff line number Diff line change @@ -43,6 +43,17 @@ class Test(BaseModel):
43
43
assert exc_info .value .code == 0
44
44
45
45
46
+ def test_help_general_2 (capsys ):
47
+ class Test (BaseModel ):
48
+ a : str = pa .KwArg (..., description = "test" )
49
+ b : str = pa .KwArg (None , description = "test" )
50
+
51
+ output = read_output (Test , ["--help" ], capsys ).out
52
+
53
+ assert "--help (-H)" in output
54
+ assert "Show this message and exit." in output
55
+
56
+
46
57
def test_parserconfig (capsys ):
47
58
class Test (BaseModel ):
48
59
__parserconfig__ = pa .parserconfig (
You can’t perform that action at this time.
0 commit comments