# just a short example of using optparse
import getpass
import optparse
# def parseCmdArgs():
cmdOpts = optparse.OptionParser(usage = '%prog [options]')
cmdOpts.add_option('-i', dest = 'ipaddr', help = 'IP address of CIMC')
cmdOpts.add_option('-u', dest = 'user', help = 'Username')
cmdOpts.add_option('-p', dest = 'passwd', help = 'Password (Optional. If not provided you will be prompted.)')
cmdOpts.add_option('-l', action = 'store_true', dest = 'list', help = 'Just query running firmware.')
cmdOpts.add_option('-v', action = 'store_true', dest = 'verbose', help = 'Verbose output')
cmdOpts.add_option('-n', action = 'store_true', dest = 'dry', help = 'Dry run')
(opts, args) = cmdOpts.parse_args()
def getpassword(prompt = "CIMC Password: "):
return getpass.unix_getpass(prompt)%