File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -16,15 +16,13 @@ def getHelpTxt(command=None):
16
16
out , err = p .communicate ()
17
17
return out
18
18
19
- if __name__ == '__main__' :
20
- #commands = defaultdict(defaultdict(list))
19
+ def parseCommands ():
21
20
commands = defaultdict (defaultdict )
22
21
helpTxt = getHelpTxt ()
23
22
#print helpTxt
24
23
for line in helpTxt .split ('\n ' ):
25
24
match = re .search (commandRegex , line )
26
25
if match :
27
- print "have match"
28
26
g = match .groupdict ()
29
27
commands [g ["command" ]]["helptxt" ] = g ["helptxt" ]
30
28
commands [g ["command" ]]["subcommands" ] = []
@@ -35,7 +33,12 @@ def getHelpTxt(command=None):
35
33
for line in helpTxt .split ('\n ' ):
36
34
match = re .search (subcommandRegex , line )
37
35
if match :
38
- print match .groupdict ()
36
+ commands [commandKey ]["subcommands" ].append (match .groupdict ())
37
+
38
+ print commands
39
+
40
+ if __name__ == '__main__' :
41
+ parseCommands ()
39
42
40
43
# At this point we have a list of all the commands and sub commands
41
44
# for each command create a Bash function
You can’t perform that action at this time.
0 commit comments