File tree Expand file tree Collapse file tree 2 files changed +39
-23
lines changed
Expand file tree Collapse file tree 2 files changed +39
-23
lines changed Original file line number Diff line number Diff line change 1- import ipdb
2- from chatdbg .chatdbg_pdb import ChatDBG
3- from chatdbg .util .config import chatdbg_config
41import sys
2+ from getopt import GetoptError
53
6- _usage = """\
7- usage: python -m ipdb [-m] [-c command] ... pyfile [arg] ...
8-
9- Debug the Python program given by pyfile.
10-
11- Initial commands are read from .pdbrc files in your home directory
12- and in the current directory, if they exist. Commands supplied with
13- -c are executed after commands from .pdbrc files.
14-
15- To let the script run until an exception occurs, use "-c continue".
16- To let the script run up to a given line X in the debugged file, use
17- "-c 'until X'"
18-
19- Option -m is available only in Python 3.7 and later.
4+ import ipdb
205
21- ChatDBG-specific options may appear anywhere before pyfile:
22- """
6+ from chatdbg .chatdbg_pdb import ChatDBG
7+ from chatdbg .util .config import chatdbg_config
8+ from chatdbg .util .help import print_help
239
2410
2511def main () -> None :
@@ -28,13 +14,16 @@ def main() -> None:
2814 args = chatdbg_config .parse_user_flags (sys .argv [1 :])
2915
3016 if "-h" in args or "--help" in args :
31- print (_usage )
32- print (chatdbg_config .user_flags_help ())
33- sys .exit ()
17+ print_help ()
3418
3519 sys .argv = [sys .argv [0 ]] + args
3620
37- ipdb .__main__ .main ()
21+ try :
22+ ipdb .__main__ .main ()
23+ except GetoptError as e :
24+ print (f"Unrecognized option: { e .opt } \n " )
25+ print_help ()
26+ sys .exit (1 )
3827
3928
4029if __name__ == "__main__" :
Original file line number Diff line number Diff line change 1+ import sys
2+
3+ from chatdbg .util .config import chatdbg_config
4+
5+ _usage = """\
6+ usage: python -m ipdb [-m] [-c command] ... pyfile [arg] ...
7+
8+ Debug the Python program given by pyfile.
9+
10+ Initial commands are read from .pdbrc files in your home directory
11+ and in the current directory, if they exist. Commands supplied with
12+ -c are executed after commands from .pdbrc files.
13+
14+ To let the script run until an exception occurs, use "-c continue".
15+ To let the script run up to a given line X in the debugged file, use
16+ "-c 'until X'"
17+
18+ Option -m is available only in Python 3.7 and later.
19+
20+ ChatDBG-specific options may appear anywhere before pyfile:
21+ """
22+
23+
24+ def print_help ():
25+ print (_usage )
26+ print (chatdbg_config .user_flags_help ())
27+ sys .exit ()
You can’t perform that action at this time.
0 commit comments