NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
| #!/usr/bin/python | |
| import sys | |
| import os | |
| import glob | |
| import subprocess | |
| import getopt | |
| def parse_project_option(keys, value, target): | |
| key = keys.pop(0) |
NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
| #!/usr/bin/env python | |
| import cmd | |
| import dircache | |
| class MyCmd(cmd.Cmd): | |
| def __init__(self): | |
| cmd.Cmd.__init__(self) | |
| self.prompt = '(MyCmd)' |