@@ -0,0 +1,1482 @@
+#!/usr/bin/env python%0A%22%22%22%0AThis example uses docopt with the built in cmd module to demonstrate an interactive command application.%0A%0AUsage:%0A    my_program tcp %3Chost%3E %3Cport%3E %5B--timeout=%3Cseconds%3E%5D%0A    my_program serial %3Cport%3E %5B--baud=%3Cn%3E%5D %5B--timeout=%3Cseconds%3E%5D%0A    my_program (-i %7C --interactive)%0A    my_program (-h %7C --help %7C --version)%0A%0AOptions:%0A    -i, --interactive  Interactive Mode%0A    -h, --help  Show this screen and exit.%0A    --baud=%3Cn%3E  Baudrate %5Bdefault: 9600%5D%0A%22%22%22%0A%0Aimport sys, cmd%0Afrom docopt import docopt%0A%0Aclass MyInteractive (cmd.Cmd):%0A    intro   = 'Welcome to my interactive program!'%0A    prompt  = '(my_program) '%0A    file    = None%0A    %0A    def do_tcp(self, arg):%0A        %22%22%22Usage: tcp %3Chost%3E %3Cport%3E %5B--timeout=%3Cseconds%3E%5D%22%22%22%0A        %0A        doc = self.do_tcp.__doc__ %0A        %0A        try:%0A            opt = docopt(doc,arg)%0A        except:%0A            print(doc)%0A            return%0A            %0A        print(opt)%0A%0A    def do_serial(self, arg):%0A        %22%22%22Usage: serial %3Cport%3E %5B--baud=%3Cn%3E%5D %5B--timeout=%3Cseconds%3E%5D%0AOptions:%0A    --baud=%3Cn%3E  Baudrate %5Bdefault: 9600%5D%0A        %22%22%22%0A%0A        doc = self.do_serial.__doc__%0A%0A        try:%0A            opt = docopt(doc,arg)%0A        except:%0A            print(doc)%0A            return%0A%0A        print(opt)%0A    %0A    def do_quit(self, arg):%0A        %22%22%22Quits out of Interactive Mode.%22%22%22%0A%0A        print('Good Bye!')%0A        exit()%0A%0Aopt = docopt(__doc__, sys.argv%5B1:%5D)%0A%0Aif opt%5B'--interactive'%5D: %0A    MyInteractive().cmdloop()%0A%0Aprint(opt)%0A

Create interactive_example.py