version 1.1, 2013/03/07 15:37:38
|
version 1.4, 2015/07/27 20:54:52
|
Line 1
|
Line 1
|
#!/usr/bin/python |
#!/usr/bin/python |
|
# -*- coding: utf-8 -*- |
|
|
import os, sys |
""" |
import optparse |
+------------------------------------------------------------------------------ |
|
| |
|
| Copyright Nicholas DeClario 2013 |
|
| Nicholas DeClario <nick@demandred.dyndns.org> |
|
| March 2013 |
|
| $Id$ |
|
| |
|
+------------------------------------------------------------------------------ |
|
|
|
""" |
|
import os |
|
import sys |
|
import argparse |
|
|
############################################################################### |
""" |
## displayMan( ) |
fetchOptions() |
## |
|
## I'm hoping to eventually get this to display a man page for the |
|
## running script. I don't know if that is possible with Python. |
|
## |
|
############################################################################### |
|
def displayMan( ): |
|
pass |
|
|
|
############################################################################### |
|
## |
|
## fetchOptions( ) |
|
## |
|
## Grab our command line arguments and toss them in to a hash |
|
## |
|
############################################################################### |
|
def fetchOptions( ): |
|
parse = optparse.OptionParser( ) |
|
parse.add_option( '-m', '--man', help='Display the man page', \ |
|
dest='man', default=False, action='store_true' ) |
|
parse.add_option( '-t', '--test', help='Test Argument', dest='test' ) |
|
|
|
return parse.parse_args( ) |
|
|
|
############################################################################### |
|
## |
|
## The magic starts here |
|
## |
|
############################################################################### |
|
def main( ): |
|
global opts |
|
global args |
|
|
|
(opts, args) = fetchOptions( ) |
Grab our command line arguments and toss them in to a hash |
|
""" |
|
|
if opts.man == True: displayMan( ) |
|
|
|
|
def fetchOptions(): |
|
parse = argparse.ArgumentParser() |
|
parse.add_argument('-m', '--man', help='Display the man page', \ |
|
dest='man', default=False, action='store_true') |
|
parse.add_argument('-t', '--test', help='Test Argument', dest='test') |
|
|
if __name__ == '__main__': main( ) |
return parse.parse_args() |
|
|
|
""" |
|
The magic starts here |
|
""" |
|
|
|
|
|
def main(): |
|
|
|
if opts.man: |
|
displayMan() |
|
|
|
|
|
if __name__ == '__main__': |
|
opts = fetchOptions() |
|
main() |