Pylint settings
This commit is contained in:
parent
be932ea9c4
commit
a99b81b0c7
12 changed files with 140 additions and 3 deletions
dockge_cli/client/commandprovider
|
@ -7,6 +7,10 @@ from ...service.communicate import DockgeConnection
|
|||
from ..utils import stack_formatter, status_formatter, generic_formatter, get_credential_parser
|
||||
|
||||
class ExecutionCommands():
|
||||
"""
|
||||
Helper class that provides all the static methods in an organized way
|
||||
This is an abstraction layer of the CLI, as those functions only do little preprocessing before calling the actural DockgeConnection
|
||||
"""
|
||||
@staticmethod
|
||||
def __setup():
|
||||
con = DockgeConnection()
|
||||
|
@ -15,6 +19,9 @@ class ExecutionCommands():
|
|||
|
||||
@staticmethod
|
||||
def host(extra_args):
|
||||
"""
|
||||
host command binding
|
||||
"""
|
||||
if len(extra_args) > 0:
|
||||
res = urlparse(extra_args[0])
|
||||
if all([res.scheme, res.netloc]):
|
||||
|
@ -26,6 +33,9 @@ class ExecutionCommands():
|
|||
|
||||
@staticmethod
|
||||
def login(extra_args):
|
||||
"""
|
||||
login command binding
|
||||
"""
|
||||
if len(extra_args) > 0:
|
||||
credentials = get_credential_parser().parse_args(extra_args, namespace=Credentials)
|
||||
storage.put("username", credentials.username, encoded=True)
|
||||
|
@ -36,21 +46,33 @@ class ExecutionCommands():
|
|||
|
||||
@staticmethod
|
||||
def logout(_):
|
||||
"""
|
||||
logout command binding
|
||||
"""
|
||||
storage.remove("username")
|
||||
storage.remove("password")
|
||||
|
||||
@staticmethod
|
||||
def exit(_):
|
||||
"""
|
||||
exit command binding
|
||||
"""
|
||||
storage.clear()
|
||||
|
||||
@staticmethod
|
||||
def list(_):
|
||||
"""
|
||||
list command binding
|
||||
"""
|
||||
con = ExecutionCommands.__setup()
|
||||
stack_formatter(con.list_stacks())
|
||||
con.disconnect()
|
||||
|
||||
@staticmethod
|
||||
def status(extra_args):
|
||||
"""
|
||||
status command binding
|
||||
"""
|
||||
if extra_args is None:
|
||||
raise ValueError
|
||||
con = ExecutionCommands.__setup()
|
||||
|
@ -59,6 +81,9 @@ class ExecutionCommands():
|
|||
|
||||
@staticmethod
|
||||
def restart(extra_args):
|
||||
"""
|
||||
restart command binding
|
||||
"""
|
||||
if extra_args is None:
|
||||
raise ValueError
|
||||
con = ExecutionCommands.__setup()
|
||||
|
@ -67,6 +92,9 @@ class ExecutionCommands():
|
|||
|
||||
@staticmethod
|
||||
def update(extra_args):
|
||||
"""
|
||||
update command binding
|
||||
"""
|
||||
if extra_args is None:
|
||||
raise ValueError
|
||||
con = ExecutionCommands.__setup()
|
||||
|
@ -75,6 +103,9 @@ class ExecutionCommands():
|
|||
|
||||
@staticmethod
|
||||
def stop(extra_args):
|
||||
"""
|
||||
stop command binding
|
||||
"""
|
||||
if extra_args is None:
|
||||
raise ValueError
|
||||
con = ExecutionCommands.__setup()
|
||||
|
@ -83,6 +114,9 @@ class ExecutionCommands():
|
|||
|
||||
@staticmethod
|
||||
def start(extra_args):
|
||||
"""
|
||||
start command binding
|
||||
"""
|
||||
if extra_args is None:
|
||||
raise ValueError
|
||||
con = ExecutionCommands.__setup()
|
||||
|
@ -91,6 +125,9 @@ class ExecutionCommands():
|
|||
|
||||
@staticmethod
|
||||
def down(extra_args):
|
||||
"""
|
||||
down command binding
|
||||
"""
|
||||
if extra_args is None:
|
||||
raise ValueError
|
||||
con = ExecutionCommands.__setup()
|
||||
|
@ -99,4 +136,7 @@ class ExecutionCommands():
|
|||
|
||||
@staticmethod
|
||||
def help():
|
||||
"""
|
||||
exit command binding - This should never be invoked
|
||||
"""
|
||||
print("WTF")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue