From 144db8f60c867156b0f05e71e8b849e35e372046 Mon Sep 17 00:00:00 2001
From: Seblu <sebastien.luttringer@smartjog.com>
Date: Fri, 20 May 2011 18:06:50 +0200
Subject: [PATCH] Change command loading schema

---
 cccli/command/__init__.py | 80 +++++++++++++++++++++++++++++++++++----
 cccli/commands.py         |  2 +-
 2 files changed, 73 insertions(+), 9 deletions(-)

diff --git a/cccli/command/__init__.py b/cccli/command/__init__.py
index a04b164..d4d3fc5 100644
--- a/cccli/command/__init__.py
+++ b/cccli/command/__init__.py
@@ -5,15 +5,59 @@
 CloudControl CLI Commands Package
 '''
 
-# bunch of command
-from cccli.command.account import *
-from cccli.command.alias import *
-from cccli.command.right import *
-from cccli.command.shell import *
-from cccli.command.tag import *
-from cccli.command.vm import *
+__all__ = [
+    "Command",
+    "OptionCommand",
+    "RemoteCommand",
+    "TqlCommand",
+    "Command_addaccount",
+    "Command_addright",
+    "Command_addtag",
+    "Command_alias",
+    "Command_cancel",
+    "Command_clear",
+    "Command_clone",
+    "Command_close",
+    "Command_declose",
+    "Command_delaccount",
+    "Command_delright",
+    "Command_deltag",
+    "Command_destroy",
+    "Command_execute",
+    "Command_expert",
+    "Command_help",
+    "Command_history",
+    "Command_jobs",
+    "Command_kill",
+    "Command_list",
+    "Command_migrate",
+    "Command_passwd",
+    "Command_pause",
+    "Command_quit",
+    "Command_resume",
+    "Command_rights",
+    "Command_server",
+    "Command_shutdown",
+    "Command_start",
+    "Command_stop",
+    "Command_tagdisplay",
+    "Command_tags",
+    "Command_unalias",
+    "Command_undefine",
+    "Command_usage",
+    "Command_version",
+    "Command_whoami",
+]
 
-# by command module
+# importing
+from cccli.command.command import Command, OptionCommand, RemoteCommand, TqlCommand
+from cccli.command.account import Command_addaccount
+from cccli.command.account import Command_close
+from cccli.command.account import Command_declose
+from cccli.command.account import Command_delaccount
+from cccli.command.account import Command_passwd
+from cccli.command.alias import Command_alias
+from cccli.command.alias import Command_unalias
 from cccli.command.cancel import Command_cancel
 from cccli.command.execute import Command_execute
 from cccli.command.expert import Command_expert
@@ -21,6 +65,26 @@ from cccli.command.jobs import Command_jobs
 from cccli.command.kill import Command_kill
 from cccli.command.list import Command_list
 from cccli.command.migrate import Command_migrate
+from cccli.command.right import Command_addright
+from cccli.command.right import Command_delright
+from cccli.command.right import Command_rights
 from cccli.command.server import Command_server
+from cccli.command.shell import Command_clear
+from cccli.command.shell import Command_help
+from cccli.command.shell import Command_history
+from cccli.command.shell import Command_quit
+from cccli.command.shell import Command_usage
+from cccli.command.shell import Command_version
+from cccli.command.shell import Command_whoami
 from cccli.command.shutdown import Command_shutdown
+from cccli.command.tag import Command_addtag
+from cccli.command.tag import Command_deltag
+from cccli.command.tag import Command_tags
 from cccli.command.tagdisplay import Command_tagdisplay
+from cccli.command.vm import Command_clone
+from cccli.command.vm import Command_destroy
+from cccli.command.vm import Command_pause
+from cccli.command.vm import Command_resume
+from cccli.command.vm import Command_start
+from cccli.command.vm import Command_stop
+from cccli.command.vm import Command_undefine
diff --git a/cccli/commands.py b/cccli/commands.py
index f424cbb..21a463f 100644
--- a/cccli/commands.py
+++ b/cccli/commands.py
@@ -30,7 +30,7 @@ class Commands(object):
         # remove not available commands
         for cname in tuple(self.cmds):
             cobj = self.cmds[cname](self.cli, cname)
-            if isinstance(cobj, command.RemoteCommand):
+            if isinstance(cobj, RemoteCommand):
                 try:
                     if len(cobj.remote_functions()) == 0:
                         raise NotImplementedError("No remote function")
-- 
GitLab