File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -26,11 +26,7 @@ def print_cmd(cmd, super=""):
26
26
p ["name" ],
27
27
p ["type" ]["param_type" ] if p ["type" ]["param_type" ] != "Unprocessed" else "String" ,
28
28
"yes" if p ["required" ] else "" ,
29
- '"' + p ["default" ] + '"'
30
- if p ["default" ] and p ["type" ]["param_type" ] == "String"
31
- else Path (p ["default" ]).relative_to (Path .cwd ())
32
- if p ["default" ] and p ["type" ]["param_type" ] == "Path"
33
- else p ["default" ],
29
+ format_default_value (p ["default" ], p ["type" ]["param_type" ]),
34
30
]
35
31
for p in cmd ["params" ]
36
32
if p ["name" ] != "help"
@@ -39,6 +35,16 @@ def print_cmd(cmd, super=""):
39
35
doc += "\n \n "
40
36
41
37
38
+ def format_default_value (default , param_type ):
39
+ if default is None :
40
+ return ""
41
+ if param_type == "String" :
42
+ return f'"{ default } "'
43
+ if param_type == "Path" :
44
+ return str (default )
45
+ return default
46
+
47
+
42
48
with Context (cli ) as ctx :
43
49
info = ctx .to_info_dict ()
44
50
# root-level commands first
You can’t perform that action at this time.
0 commit comments