#!/usr/bin/python
"""
pskel
A Python skeleton maker for shell scripts
"""
print '''
"""
APPNAME
APPDESCRIPTION
Usage:
APPUSAGE
Synopsis
SYNOPSIS
"""
import sys
import getopt
def main():
#Parse command line options
try:
opts, args = getopt.getopt(sys.argv[1:], 'h', ['help'])
except getopt.error, msg:
print msg
print "for help use --help"
sys.exit(2)
#Process options
for o, a in opts:
if o in ["-h", "--help"]:
print __doc__
sys.exit(0)
#Do the rest here
if o == '-v':
#handle options
pass
#Process arguments here
#Call Processing methods here
if __name__=="__main__":
main()
'''
Wednesday, May 23, 2007
Quick Python script skeleton generator
A friend sent me this useful little script to get a quick skeleton code for small Python shell scripts. Perfect when writing quick filters.
Subscribe to:
Post Comments (Atom)
1 comment:
Well written article.
Post a Comment