Created
May 7, 2014 08:38
-
-
Save RaminNietzsche/2a031f55ea4dafe22b37 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import getopt, sys | |
VERSION = 0.1 | |
def help(): | |
print '-h for help\n-v for version\n-p <str> or --print <str> for print string' | |
def main(argv): | |
try: | |
# hvp: | |
# -h ro bekho0n | |
# -v ro bekho0n | |
# -p ro bekho0n ba voro0di badiee | |
# print= | |
# --print ro bekho0n ba voro0di badiee | |
opts, args = getopt.getopt(argv,"hvp:",["print="]) | |
except: | |
pass | |
for arg, value in opts: | |
if arg == '-v': | |
print VERSION | |
exit(0) | |
elif arg == '-h': | |
help() | |
exit(0) | |
elif arg in ('-p', '--print'): | |
print value | |
if __name__ == "__main__": | |
main(sys.argv[1:]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment