Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.2
open-ovf
lsovf.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File lsovf.patch of Package open-ovf
Index: open-ovf-0.1/py/scripts/lsovf =================================================================== --- open-ovf-0.1.orig/py/scripts/lsovf +++ open-ovf-0.1/py/scripts/lsovf @@ -12,8 +12,10 @@ ############################################################################## import sys -from optparse import OptionParser +from ovf.commands import cli +from ovf.commands import VERSION_STR +from ovf.OvfFile import OvfFile from ovf.OvfFile import OvfFile def getEfile(ovfFile, options): @@ -397,29 +399,10 @@ def getOS(ovfFile, options): print child.firstChild.data def main(): - usage = "usage: %prog command [options]" - command = None - parser = OptionParser(usage) - for long in commands.keys(): - parser.add_option("--" + long, help=commands[long]['help'], - action="store_true") - - #do the help stuff up here.... - if len(sys.argv) > 1: - for long in commands: - if sys.argv[1] == "--" + long or sys.argv[1] == long: - command = long - break - - if command == None or sys.argv[1] == "--help" or sys.argv[1] == "-h": - parser.parse_args(['--help']) - exit(command != None) - - parser = OptionParser(usage) - for opt in commands[long]['args']+common: - parser.add_option(*opt['flags'], **opt['parms']) + usage = "usage: lsovf command --file <Ovf file path> [options]" + cliParser = cli.CLI(commands, common, usage=usage, version=VERSION_STR) + command, options, args = cliParser.parseArgs() - (options, args) = parser.parse_args(sys.argv[2:]) ovfFile = None if options.ovfFile: try: @@ -443,92 +426,92 @@ commands = { 'args' : ( { 'flags' : [ '--vv' ], 'parms' : { 'dest' : 'vv', - 'help' : 'Very verbose. Only show some parts of the\ - section.','action': 'store_true','default':False } }, + 'help' : "Very verbose. Only show some parts of the " + "section.",'action': 'store_true','default':False } }, ) }, "disk" : { 'func': getDisk, - 'help' : 'List the disks from the Disk Section.', + 'help' : "List the disks from the Disk Section.", 'args' : ( { 'flags' : [ '--vv' ], 'parms' : { 'dest' : 'vv', - 'help' : 'Very verbose. Only show some parts of the\ - section.','action': 'store_true','default':False } }, + 'help' : "Very verbose. Only show some parts of the " + "section.",'action': 'store_true','default':False } }, ) }, "net" : { 'func': getNetwork, - 'help' : 'List the networks from the network Section.', + 'help' : "List the networks from the network Section.", 'args' : ( { 'flags' : [ '--vv' ], 'parms' : { 'dest' : 'vv', - 'help' : 'Very verbose. Only show some parts of the\ - section.','action': 'store_true','default':False } }, + 'help' : "Very verbose. Only show some parts of the " + "section.",'action': 'store_true','default':False } }, ) }, "deploy" : { 'func': getDeploy, - 'help' : 'List the Deploymen Options Section.', + 'help' : "List the Deploymen Options Section.", 'args' : ( { 'flags' : [ '--vv' ], 'parms' : { 'dest' : 'vv', - 'help' : 'Very verbose. Only show some parts of the\ - section.','action': 'store_true','default':False } }, + 'help' : "Very verbose. Only show some parts of the " + "section.",'action': 'store_true','default':False } }, ) }, "vsc" : { 'func': getVSC, - 'help' : 'List a Virtual System Collection', + 'help' : "List a Virtual System Collection", 'args' : ( { 'flags' : [ '--vv' ], 'parms' : { 'dest' : 'vv', - 'help' : 'Very verbose. Only show some parts of the\ - section.','action': 'store_true','default':False } }, + 'help' : "Very verbose. Only show some parts of the " + "section.",'action': 'store_true','default':False } }, ) }, "vs" : { 'func': getVS, - 'help' : 'Lists a Virtual System.', + 'help' : "Lists a Virtual System.", 'args' : ( { 'flags' : [ '--vv' ], 'parms' : { 'dest' : 'vv', - 'help' : 'Very verbose. Only show some parts of the\ - section.','action': 'store_true','default':False } }, + 'help' : "Very verbose. Only show some parts of the " + "section.",'action': 'store_true','default':False } }, ) }, "virthw" : { 'func': getHW, - 'help' : 'List a Virtual Hardware Section.', + 'help' : "List a Virtual Hardware Section.", 'args' : ( { 'flags' : [ '--vv' ], 'parms' : { 'dest' : 'vv', - 'help' : 'Very verbose. Only show some parts of the\ - section.','action': 'store_true','default':False } }, + 'help' : "Very verbose. Only show some parts of the " + "section.",'action': 'store_true','default':False } }, ) }, "resource" : { 'func': _getRes, - 'help' : 'Define resources.', + 'help' : "List resources.", 'args' : ( { 'flags' : [ '--vv' ], 'parms' : { 'dest' : 'vv', - 'help' : 'Very verbose. Only show some parts of the\ - section.','action': 'store_true','default':False } }, + 'help' : "Very verbose. Only show some parts of the " + "section.",'action': 'store_true','default':False } }, ) }, "resAlloc" : { 'func' : _findResAlloc, - 'help' : "List the Resource Allocation Sections. ", + 'help' : "List the Resource Allocation Sections.", 'args' : ( { 'flags' : [ '--vv' ], 'parms' : { 'dest' : 'vv', - 'help' : 'Very verbose. Only show some parts of the\ - section.','action': 'store_true','default':False } }, + 'help' : "Very verbose. Only show some parts of the " + "section.",'action': 'store_true','default':False } }, ) }, "annotate" : { @@ -537,8 +520,8 @@ commands = { 'args' : ( { 'flags' : [ '--vv' ], 'parms' : { 'dest' : 'vv', - 'help' : 'Very verbose. Only show some parts of the\ - section.','action': 'store_true','default':False } }, + 'help' : "Very verbose. Only show some parts of the " + "section.",'action': 'store_true','default':False } }, ) }, "product" : { @@ -547,60 +530,60 @@ commands = { 'args' : ( { 'flags' : [ '--vv' ], 'parms' : { 'dest' : 'vv', - 'help' : 'Very verbose. Only show some parts of the\ - section.','action': 'store_true','default':False } }, + 'help' : "Very verbose. Only show some parts of the " + "section.",'action': 'store_true','default':False } }, ) }, "license" : { 'func': getLicense, - 'help' : "List the legal temrs for using a particular entity. ", + 'help' : "List the legal temrs for using a particular entity.", 'args' : ( { 'flags' : [ '--vv' ], 'parms' : { 'dest' : 'vv', - 'help' : 'Very verbose. Only show some parts of the\ - section.','action': 'store_true','default':False } }, + 'help' : "Very verbose. Only show some parts of the " + "section.",'action': 'store_true','default':False } }, ) }, "startup" : { 'func': getStartup, - 'help' : "List the startup section for either a Virtual System or a\ - Virtual System Collection. ", + 'help' : "List the startup section for either a Virtual System or a " + "Virtual System Collection.", 'args' : ( { 'flags' : [ '--vv' ], 'parms' : { 'dest' : 'vv', - 'help' : 'Very verbose. Only show some parts of the\ - section.','action': 'store_true','default':False } }, + 'help' : "Very verbose. Only show some parts of the " + "section.",'action': 'store_true','default':False } }, ) }, "compat" : { 'func': getCompat, - 'help' : 'List CPU Compatibility Section which specifies requirements on\ - the virtualized CPU. It is only valid in a Virtual System Section.', + 'help' : "List CPU Compatibility Section which specifies requirements on " + "the virtualized CPU. It is only valid in a Virtual System Section.", 'args' : ( { 'flags' : [ '--vv' ], 'parms' : { 'dest' : 'vv', - 'help' : 'Very verbose. Only show some parts of the\ - section.','action': 'store_true','default':False } }, + 'help' : "Very verbose. Only show some parts of the " + "section.",'action': 'store_true','default':False } }, ) }, "os" : { 'func': getOS, - 'help' : 'List the operating systems section for a Virtual System.', + 'help' : "List the operating systems section for a Virtual System.", 'args' : ( { 'flags' : [ '--vv' ], - 'parms' : { 'dest' : 'vv','help' : 'Very verbose. Only show some\ - parts of the section.','action': 'store_true','default':False } }, + 'parms' : { 'dest' : 'vv','help' : "Very verbose. Only show some " + "parts of the section.",'action': 'store_true','default':False } }, ) }, "install" : { 'func': getInstall, - 'help' : 'List the install section used to describe a virtual system in\ - a virtual system collection.', + 'help' : "List the install section used to describe a virtual system in " + "a virtual system collection.", 'args' : ( { 'flags' : [ '--vv' ], 'parms' : { 'dest' : 'vv', - 'help' : 'Very verbose. Only show some parts of the\ - section.','action': 'store_true','default':False } }, + 'help' : "Very verbose. Only show some parts of the " + "section.",'action': 'store_true','default':False } }, ) }, @@ -618,15 +601,15 @@ common = ( { 'flags' : [ '-f', '--file' ], - 'parms' : { 'dest' : 'ovfFile', 'help': 'Target OVF.' } + 'parms' : { 'dest' : 'ovfFile', 'help' : "Target OVF." } }, { 'flags' : [ '--id' ], 'parms' : { 'dest' : 'id', - 'help':'ID of the section to attach to, if any.'} + 'help' : "ID of the section to attach to, if any."} }, { 'flags' : [ '--verbose' ], 'parms' : {'action':'store_true', 'dest' : 'verbose', - 'help':'Display with verbose.' } + 'help' : "Display with verbose." } }, )
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor