@@ -1252,6 +1252,9 @@ def __init__(
1252
1252
conflict_handler : str = 'error' ,
1253
1253
add_help : bool = True ,
1254
1254
allow_abbrev : bool = True ,
1255
+ exit_on_error : bool = True ,
1256
+ suggest_on_error : bool = False ,
1257
+ color : bool = False ,
1255
1258
* ,
1256
1259
ap_completer_type : Optional [Type ['ArgparseCompleter' ]] = None ,
1257
1260
) -> None :
@@ -1262,20 +1265,43 @@ def __init__(
1262
1265
behavior on this parser. If this is None or not present, then cmd2 will use
1263
1266
argparse_completer.DEFAULT_AP_COMPLETER when tab completing this parser's arguments
1264
1267
"""
1265
- super (Cmd2ArgumentParser , self ).__init__ (
1266
- prog = prog ,
1267
- usage = usage ,
1268
- description = description ,
1269
- epilog = epilog ,
1270
- parents = parents if parents else [],
1271
- formatter_class = formatter_class , # type: ignore[arg-type]
1272
- prefix_chars = prefix_chars ,
1273
- fromfile_prefix_chars = fromfile_prefix_chars ,
1274
- argument_default = argument_default ,
1275
- conflict_handler = conflict_handler ,
1276
- add_help = add_help ,
1277
- allow_abbrev = allow_abbrev ,
1278
- )
1268
+ # TODO: CHANGE so if Python >= 3.14 new args are passed
1269
+ if sys .version_info [1 ] >= 14 :
1270
+ # Python >= 3.14 so pass new arguments to parent argparse.ArgumentParser class
1271
+ super (Cmd2ArgumentParser , self ).__init__ (
1272
+ prog = prog ,
1273
+ usage = usage ,
1274
+ description = description ,
1275
+ epilog = epilog ,
1276
+ parents = parents if parents else [],
1277
+ formatter_class = formatter_class , # type: ignore[arg-type]
1278
+ prefix_chars = prefix_chars ,
1279
+ fromfile_prefix_chars = fromfile_prefix_chars ,
1280
+ argument_default = argument_default ,
1281
+ conflict_handler = conflict_handler ,
1282
+ add_help = add_help ,
1283
+ allow_abbrev = allow_abbrev ,
1284
+ exit_on_error = exit_on_error ,
1285
+ suggest_on_error = suggest_on_error ,
1286
+ color = color ,
1287
+ )
1288
+ else :
1289
+ # Python < 3.14, so don't pass new arguments to parent argparse.ArgumentParser class
1290
+ super (Cmd2ArgumentParser , self ).__init__ (
1291
+ prog = prog ,
1292
+ usage = usage ,
1293
+ description = description ,
1294
+ epilog = epilog ,
1295
+ parents = parents if parents else [],
1296
+ formatter_class = formatter_class , # type: ignore[arg-type]
1297
+ prefix_chars = prefix_chars ,
1298
+ fromfile_prefix_chars = fromfile_prefix_chars ,
1299
+ argument_default = argument_default ,
1300
+ conflict_handler = conflict_handler ,
1301
+ add_help = add_help ,
1302
+ allow_abbrev = allow_abbrev ,
1303
+ exit_on_error = exit_on_error ,
1304
+ )
1279
1305
1280
1306
self .set_ap_completer_type (ap_completer_type ) # type: ignore[attr-defined]
1281
1307
0 commit comments