Revision 38db356b kamaki/cli/command_tree/__init__.py

b/kamaki/cli/command_tree/__init__.py
40 40
    subcommands = {}
41 41
    help = ' '
42 42

  
43
    def __init__(self, path, help=' ', subcommands={}, cmd_class=None):
43
    def __init__(
44
            self, path,
45
            help=' ', subcommands={}, cmd_class=None, long_help=''):
44 46
        assert path, 'Cannot initialize a command without a command path'
45 47
        self.path = path
46 48
        self.help = help or ''
47 49
        self.subcommands = dict(subcommands) if subcommands else {}
48 50
        self.cmd_class = cmd_class or None
51
        self.long_help = '%s' % (long_help or '')
49 52

  
50 53
    @property
51 54
    def name(self):
......
109 112

  
110 113
class CommandTree(object):
111 114

  
112
    def __init__(self, name, description=''):
115
    def __init__(self, name, description='', long_description=''):
113 116
        self.name = name
114 117
        self.description = description
118
        self.long_description = '%s' % (long_description or '')
115 119
        self.groups = dict()
116 120
        self._all_commands = dict()
117 121

  
......
119 123
        for group in groups_to_exclude:
120 124
            self.groups.pop(group, None)
121 125

  
122
    def add_command(self, command_path, description=None, cmd_class=None):
126
    def add_command(
127
            self, command_path,
128
            description=None, cmd_class=None, long_description=''):
123 129
        terms = command_path.split('_')
124 130
        try:
125 131
            cmd = self.groups[terms[0]]
......
139 145
                cmd = new_cmd
140 146
        cmd.cmd_class = cmd_class or None
141 147
        cmd.help = description or None
148
        cmd.long_help = long_description or cmd.long_help
142 149

  
143 150
    def find_best_match(self, terms):
144 151
        """Find a command that best matches a given list of terms

Also available in: Unified diff