本文整理汇总了Python中ussclicore.argumentParser.ArgumentParser类的典型用法代码示例。如果您正苦于以下问题:Python ArgumentParser类的具体用法?Python ArgumentParser怎么用?Python ArgumentParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ArgumentParser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: arg_export
def arg_export(self):
doParser = ArgumentParser(prog=self.cmd_name+" export", add_help = True, description="Exports a template by creating an archive (compressed tar file) that includes the json template configuration file")
mandatory = doParser.add_argument_group("mandatory arguments")
mandatory.add_argument('--id', dest='id', required=True, help="the ID of the template to export")
optional = doParser.add_argument_group("optional arguments")
optional.add_argument('--file', dest='file', required=False, help="destination path where to store the template configuration file on the local filesystem")
return doParser
示例2: arg_import
def arg_import(self):
doParser = ArgumentParser(
prog=self.cmd_name + " import", add_help=True, description="Creates a template from an archive"
)
mandatory = doParser.add_argument_group("mandatory arguments")
mandatory.add_argument("--file", dest="file", required=True, help="the path of the archive")
optional = doParser.add_argument_group("optional arguments")
optional.add_argument(
"-f",
"--force",
dest="force",
action="store_true",
help="force template creation (delete template/bundle if already exist)",
required=False,
)
optional.add_argument(
"-r",
"--rbundles",
dest="rbundles",
action="store_true",
help="if a bundle already exists, use it in the new template. Warning: this option ignore the content of the bundle described in the template file",
required=False,
)
optional.add_argument(
"--usemajor",
dest="use_major",
action="store_true",
help="use distribution major version if exit",
required=False,
)
optional.set_defaults(force=False)
optional.set_defaults(use_major=False)
return doParser
示例3: arg_info
def arg_info(self):
do_parser = ArgumentParser(prog=self.cmd_name + " info", add_help=True,
description="Displays detailed information about a machine image")
mandatory = do_parser.add_argument_group("mandatory arguments")
mandatory.add_argument('--id', dest='id', type=str, required=True,
help="the ID of the machine image to retrieve")
return do_parser
示例4: arg_list
def arg_list(self):
do_parser = ArgumentParser(prog=self.cmd_name + " list", add_help=True,
description="List the vendors registered to the marketplace")
optional = do_parser.add_argument_group("optional arguments")
optional.add_argument('--org', dest='org', required=False,
help="the organization name. If no organization is provided, then the default organization is used.")
return do_parser
示例5: arg_launch
def arg_launch(self):
do_parser = ArgumentParser(prog=self.cmd_name + " launch", add_help=True,
description="Launches a migration")
mandatory = do_parser.add_argument_group("mandatory arguments")
mandatory.add_argument('--file', dest='file', required=True,
help="yaml/json file providing the migration configuration")
return do_parser
示例6: arg_info
def arg_info(self):
doParser = ArgumentParser(add_help = True, description="Get info on provided organization")
optional = doParser.add_argument_group("optional arguments")
optional.add_argument('--org', dest='org', type=str, required=False, help="The organization name. If no organization is provided, then the default organization is used.")
return doParser
示例7: arg_add
def arg_add(self):
doParser = ArgumentParser(add_help=True, description="Add an operating system for the provided organization")
mandatory = doParser.add_argument_group("mandatory arguments")
optional = doParser.add_argument_group("optional arguments")
mandatory.add_argument(
"--arch", dest="arch", type=str, required=True, help="Operating system architecture (i386, x86_64)."
)
mandatory.add_argument(
"--name",
dest="name",
type=str,
required=True,
help="Operating system(s) name (for example CentOS, Debian etc) for which the current command should be executed.",
)
mandatory.add_argument(
"--version", dest="version", type=str, required=True, help="Operating system version (13, 5.6, ...)"
)
optional.add_argument(
"--org",
dest="org",
type=str,
required=False,
help="The organization name. If no organization is provided, then the default organization is used.",
)
return doParser
示例8: arg_create
def arg_create(self):
doParser = ArgumentParser(prog=self.cmd_name+" create", add_help = True, description="Create a new bundle and save to the UForge server")
mandatory = doParser.add_argument_group("mandatory arguments")
mandatory.add_argument('--file', dest='file', required=True, help="yaml/json file containing the bundle content")
optional = doParser.add_argument_group("optional arguments")
optional.add_argument('--archive-path', dest='archive_path', required=False, help="path of where to store the archive of the created bundle. If provided hammr, creates an archive of the created bundle, equivalent to running bundle export")
return doParser
示例9: arg_update
def arg_update(self):
doParser = ArgumentParser(add_help=True, description="Update a repository in the organisation")
mandatory = doParser.add_argument_group("mandatory arguments")
optional = doParser.add_argument_group("optional arguments")
mandatory.add_argument(
"--id", dest="id", type=int, required=True, help="Id of the repository to update in the organization."
)
optional.add_argument(
"--repoUrl",
dest="repoUrl",
type=str,
required=False,
help="Url of the repository to update in the organization.",
)
optional.add_argument(
"--type",
dest="type",
type=str,
required=False,
help="Type of the repository to update in the organization.",
)
optional.add_argument(
"--org",
dest="org",
type=str,
required=False,
help="The organization name. If no organization is provided, then the default organization is used.",
)
return doParser
示例10: arg_clone
def arg_clone(self):
doParser = ArgumentParser(prog=self.cmd_name+" clone", add_help = True, description="Clones the bundle. The clone is copying the meta-data of the bundle")
mandatory = doParser.add_argument_group("mandatory arguments")
mandatory.add_argument('--id', dest='id', required=True, help="the ID of the bundle to clone")
mandatory.add_argument('--name', dest='name', required=True, help="the name to use for the new cloned bundle")
mandatory.add_argument('--version', dest='version', required=True, help="the version to use for the cloned bundle")
return doParser
示例11: arg_publish
def arg_publish(self):
doParser = ArgumentParser(prog=self.cmd_name+" publish", add_help = True, description="Publish (upload and register) a built machine image to a target environment")
mandatory = doParser.add_argument_group("mandatory arguments")
mandatory.add_argument('--file', dest='file', required=True, help="json file providing the cloud account parameters required for upload and registration")
optional = doParser.add_argument_group("optional arguments")
optional.add_argument('--id',dest='id',required=False, help="id of the image to publish")
return doParser
示例12: arg_create
def arg_create(self):
doParser = ArgumentParser(prog=self.cmd_name + " create", add_help=True,
description="Creates a new cloud account")
mandatory = doParser.add_argument_group("mandatory arguments")
mandatory.add_argument('--file', dest='file', required=True,
help="yaml/json file providing the cloud account parameters")
return doParser
示例13: arg_add
def arg_add(self):
doParser = ArgumentParser(
prog=self.cmd_name + " add",
add_help=True,
description="Add one or more entitlements to a role within the specified organization",
)
mandatory = doParser.add_argument_group("mandatory arguments")
optional = doParser.add_argument_group("optional arguments")
mandatory.add_argument("--name", dest="name", required=True, help="The name of role")
mandatory.add_argument(
"--entitlements",
dest="entitlements",
nargs="+",
required=True,
help="List of entitlements to add to a role. You can use Unix matching system (*,?,[seq],[!seq]) and multiple match separating by space.",
)
optional.add_argument(
"--org",
dest="org",
required=False,
help="The organization name. If no organization is provided, then the default organization is used.",
)
return doParser
示例14: arg_list
def arg_list(self):
doParser = ArgumentParser(add_help=True,description="List enabled operating systems for provided user")
mandatory = doParser.add_argument_group("mandatory arguments")
mandatory.add_argument('--account', dest='account', type=str, required=True, help="User name of the account for which the current command should be executed")
return doParser
示例15: arg_disable
def arg_disable(self):
doParser = ArgumentParser(prog=self.cmd_name + " disable", add_help=True, description="Disable provided user")
mandatory = doParser.add_argument_group("mandatory arguments")
mandatory.add_argument('--account', dest='account', required=True,
help="user name of the account for which the current command should be executed")
return doParser