import websocket
import json

class Command:

    def __init__(self):
        self.commands = []
    
    def add(self,command):
        self.commands.append(command)
    
    def dumps(self):
        s = []
        for i in range(len(self.commands)):
            s.append({
                'cmdID': i,
                'cmdName': self.commands[i]
            })
        return json.dumps(s)

class SurppotCommand:

    def __init__(self):
        self.commands = []
        self.nextID = 0
    
    def add(self, typeName, command):
        return self.commands
    
    def dumps(self):
        return 1

commands = Command()
commands.add("test1")
commands.add("test2")
commands.add("test3")

print commands.dumps()

@@ -86,24 +86,48 @@
 mmands = %5B%5D%0A
+        self.nextID = 0%0A
     %0A    def
@@ -179,101 +179,74 @@
 end(
-command)
+%7B
 %0A    
-%0A
     
-def dumps(self):%0A        s = %5B%5D%0A        for i in range(len(self.
+    'cmdID': self.nextID,%0A            'cmdName': 
 command
-s)):
 %0A   
@@ -254,160 +254,175 @@
     
-    s.append(%7B%0A                'cmdID': i,
+%7D)%0A        self.nextID += 1
 %0A    
+%0A
     
-        'cmdName': self.commands%5Bi%5D%0A            %7D)%0A        return json.dumps(s)%0A%0Aclass SurppotCommand
+def array(self):%0A        return self.commands%0A%0A    def dumps(self):%0A        return json.dumps(self.commands)%0A%0Aclass CommandCatelog
 :%0A%0A 
@@ -449,39 +449,32 @@
 ):%0A        self.
-command
 s = %5B%5D%0A        s
@@ -480,36 +480,32 @@
 self.nextID = 0%0A
-    
 %0A    def add(sel
@@ -520,24 +520,25 @@
 ame, command
+s
 ):%0A        r
@@ -540,33 +540,210 @@
     
-return self.commands%0A    
+self.s.append(%7B%0A            'typeID': self.nextID,%0A            'typeName': typeName,%0A            'commands': commands%0A        %7D)%0A        self.nextID += 1%0A    %0A    def array(self):%0A        return self.s%0A
 %0A   
@@ -775,17 +775,34 @@
  return 
-1
+json.dumps(self.s)
 %0A%0Acomman
@@ -906,8 +906,118 @@
 dumps()%0A
+%0AcommandCatelog = CommandCatelog()%0AcommandCatelog.add('test', commands.array())%0A%0Aprint commandCatelog.dumps()%0A

add CommandCatelog