2323
2424
2525def process (args ):
26- print ("received <input_txt>=%r --input-file=%r --output-name=%r" %
27- (args .input_txt , args .input_file , args .output_name ))
26+ print (
27+ "received <input_txt>=%r [<suffix>=%r] --input-file=%r --output-name=%r --hidden-opt=%r" %
28+ (args .input_txt , args .suffix , args .input_file , args .output_name , args .hidden_opt ))
2829
2930
3031def get_main_parser ():
@@ -39,7 +40,7 @@ def get_main_parser():
3940
4041 parser = subparsers .add_parser ("process" , help = "parse files" )
4142 # `*.txt` file tab completion
42- parser .add_argument ("input_txt" , nargs = "?" ).complete = TXT_FILE
43+ parser .add_argument ("input_txt" , nargs = '?' ).complete = TXT_FILE
4344 # file tab completion builtin shortcut
4445 parser .add_argument ("-i" , "--input-file" ).complete = shtab .FILE
4546 parser .add_argument (
@@ -50,8 +51,9 @@ def get_main_parser():
5051 ).complete = shtab .DIRECTORY
5152 # directory tab completion builtin shortcut
5253
53- main_parser .add_argument ('suffix' , choices = ['json' , 'csv' ], default = 'json' ,
54- help = "Output format" )
54+ parser .add_argument ("suffix" , choices = ['json' , 'csv' ], default = 'json' , nargs = '?' ,
55+ help = "Output format" )
56+ parser .add_argument ("--hidden-opt" , action = 'store_true' , help = argparse .SUPPRESS )
5557 parser .set_defaults (func = process )
5658 return main_parser
5759
0 commit comments