Initial commit
This commit is contained in:
commit
1b51716d1b
72 changed files with 8204 additions and 0 deletions
71
src/redfish_cli/cli/parsers/__init__.py
Normal file
71
src/redfish_cli/cli/parsers/__init__.py
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
"""
|
||||
Code to set up the parser and subparsers for the cli
|
||||
"""
|
||||
# pylint: disable=cyclic-import
|
||||
# Note should really think about the cyclic import more, but it works for now.
|
||||
|
||||
import argparse
|
||||
|
||||
# PYTHON_ARGCOMPLETE_OK
|
||||
import argcomplete
|
||||
|
||||
from redfish_cli import cli
|
||||
|
||||
from . import base
|
||||
from . import chassis
|
||||
from . import dell
|
||||
from . import jobs
|
||||
from . import power
|
||||
from . import storage
|
||||
from . import system
|
||||
|
||||
# from .utils import add_authenticated_subparser, ArgumentTuple, EnvDefault
|
||||
|
||||
|
||||
def parse_args(args):
|
||||
"""Parse thge arguments supplied"""
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Interact with servers via RedFish. Only Dells supported at the moment"
|
||||
)
|
||||
parser.add_argument("-s", "--server", required=True, dest="server")
|
||||
parser.add_argument(
|
||||
"-f",
|
||||
"--format",
|
||||
choices=["json", "table", "text"],
|
||||
default="json",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--log-level",
|
||||
default="WARN",
|
||||
dest="log_level",
|
||||
choices=[
|
||||
"critical",
|
||||
"fatal",
|
||||
"error",
|
||||
"warning",
|
||||
"warn",
|
||||
"info",
|
||||
"debug",
|
||||
],
|
||||
)
|
||||
parser.add_argument("--debug", action="store_true")
|
||||
parser.add_argument("-l", "--log-file", default="redfish.log")
|
||||
parser.add_argument("-v", "--verbose", action="store_true")
|
||||
parser.add_argument("-V", "--verify", action="store_true")
|
||||
|
||||
subparsers = parser.add_subparsers()
|
||||
|
||||
base.add_get(subparsers)
|
||||
base.add_version_subparser(subparsers)
|
||||
base.add_product_subparser(subparsers)
|
||||
|
||||
chassis.add_chassis_subparser(subparsers)
|
||||
jobs.add_jobs_subparser(subparsers)
|
||||
power.add_power_subparser(subparsers)
|
||||
storage.add_storage_subparser(subparsers)
|
||||
system.add_system_subparser(subparsers)
|
||||
|
||||
dell.add_service_tag_subparser(subparsers)
|
||||
|
||||
argcomplete.autocomplete(parser)
|
||||
return parser.parse_args(args)
|
||||
Loading…
Add table
Add a link
Reference in a new issue