File tree Expand file tree Collapse file tree 1 file changed +22
-6
lines changed Expand file tree Collapse file tree 1 file changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -544,12 +544,28 @@ class LazyCompletionHelp:
544544 def __repr__ (self ) -> str :
545545 return f"Install or Uninstall shell completion:\n { _get_completion_help ()} "
546546
547- parser .add_argument (
548- "--shell-completion" ,
549- "-sc" ,
550- action = "store_true" ,
551- help = LazyCompletionHelp (), # type: ignore
552- )
547+ if sys .version_info >= (3 , 14 ):
548+ original_check_help = argparse .ArgumentParser ._check_help # type: ignore
549+ argparse .ArgumentParser ._check_help = ( # type: ignore
550+ lambda self , action : None
551+ )
552+ try :
553+ parser .add_argument (
554+ "--shell-completion" ,
555+ "-sc" ,
556+ action = "store_true" ,
557+ help = LazyCompletionHelp (), # type: ignore
558+ )
559+ finally :
560+ # Immediately restore normal validation
561+ argparse .ArgumentParser ._check_help = original_check_help # type: ignore
562+ else :
563+ parser .add_argument (
564+ "--shell-completion" ,
565+ "-sc" ,
566+ action = "store_true" ,
567+ help = LazyCompletionHelp (), # type: ignore
568+ )
553569
554570 parser .add_argument (
555571 "--config-path" ,
You can’t perform that action at this time.
0 commit comments