3 Sample command line application
6 from optparse
import OptionParser
9 if __name__
== "__main__":
10 # Parse command line arguments
12 # -b : batch mode, read commands from file
13 # -i : interactive mode, do not quit at the end of batch file
14 # -q : do not display startup message
15 parser
= OptionParser()
16 parser
.add_option("-b", "--batch", dest
="fn",\
17 help="Execute commands in FILE then exit",\
19 parser
.add_option("-i", "--interactive", action
="store_true",\
21 help="Go to interactive mode after executing batch file")
22 parser
.add_option("-q", "--quiet", action
="store_true",\
24 help="Do not display startup message")
25 (options
, args
) = parser
.parse_args()
27 o
= oscopy
.OscopyApp()
29 if options
.fn
is not None: