Revision 629adab4 kamaki/cli/command_tree.py
b/kamaki/cli/command_tree.py | ||
---|---|---|
84 | 84 |
def get_class(self): |
85 | 85 |
return self.cmd_class |
86 | 86 |
|
87 |
def has_subname(self, subname): |
|
88 |
return self.subcommands.has_key(subname) |
|
87 | 89 |
def get_subnames(self): |
88 | 90 |
return self.subcommands.keys() |
89 | 91 |
def get_subcommands(self): |
... | ... | |
91 | 93 |
def sublen(self): |
92 | 94 |
return len(self.subcommands) |
93 | 95 |
|
96 |
def parse_out(self, args): |
|
97 |
cmd = self |
|
98 |
index = 0 |
|
99 |
for term in args: |
|
100 |
try: |
|
101 |
cmd = cmd.subcommands[term] |
|
102 |
except KeyError: |
|
103 |
break |
|
104 |
index += 1 |
|
105 |
return cmd, args[index:] |
|
106 |
|
|
94 | 107 |
def pretty_print(self, recursive=False): |
95 | 108 |
print('Path: %s (Name: %s) is_cmd: %s\n\thelp: %s'%(self.path, self.name, |
96 | 109 |
self.is_command, self.help)) |
Also available in: Unified diff