8
8
9
9
# Top level --version is a pain to deal with so ignoring for now
10
10
# This one extracts single commands and the help txt
11
- commandRegex = r"^\s+(?P<command>\w+)\s+(?P<helptxt>[a-zA-Z ]*)$"
11
+ commandRegex = r"^\s+(?P<command>\w+)\s+(?P<helptxt>[a-zA-Z ]*)$"
12
12
13
13
# Why the hell do spaces get regexed in command1 ?
14
14
subcommandRegex = r"^\s+(?P<command1>-+[a-zA-Z_\-]+(?P<modifier1>\s+[A-Z_\-]+)?)" \
@@ -70,29 +70,32 @@ def parseCommands():
70
70
command2 .strip ()
71
71
command2 = command2 .split ()[0 ]
72
72
73
- # Not sure why the cleaning is even necessary, the regex looks correct
73
+ # Not sure why the cleaning is even necessary,
74
+ # the regex looks correct
74
75
commandMatch ["command1" ] = command1
75
76
commandMatch ["command2" ] = command2
76
-
77
+
77
78
commands [commandKey ]["subcommands" ].append (commandMatch )
78
-
79
+
79
80
# Push format for mustache
80
81
if command1 and '--' in command1 :
81
- commands [commandKey ]["DDASH_COMMANDS" ].append ({"name" : command1 })
82
+ commands [commandKey ]["DDASH_COMMANDS" ].append (
83
+ {"name" : command1 })
82
84
if command2 and '--' in command2 :
83
- commands [commandKey ]["DDASH_COMMANDS" ].append ({"name" : command2 })
85
+ commands [commandKey ]["DDASH_COMMANDS" ].append (
86
+ {"name" : command2 })
84
87
85
88
if command1 :
86
89
m = re .match ("^-[a-zA-Z]{1,2}" , command1 )
87
90
if m :
88
- commands [commandKey ]["DASH_COMMANDS" ].append ({"name" : command1 })
89
-
91
+ commands [commandKey ]["DASH_COMMANDS" ].append (
92
+ {"name" : command1 })
93
+
90
94
if command2 :
91
95
m = re .match ("^-[a-zA-Z]{1,2}" , command2 )
92
96
if m :
93
- commands [commandKey ]["DASH_COMMANDS" ].append ({"name" : command2 })
94
-
95
- #print command1, command2
97
+ commands [commandKey ]["DASH_COMMANDS" ].append (
98
+ {"name" : command2 })
96
99
97
100
return commands
98
101
@@ -126,7 +129,6 @@ def generateCompleters(commands):
126
129
127
130
128
131
def generateBoilerPlate (commands ):
129
- tmplt = ""
130
132
txt = []
131
133
132
134
with open ("templates/boilerplate.tmplt" ) as fp :
@@ -150,8 +152,7 @@ def generateScript(commands):
150
152
if __name__ == '__main__' :
151
153
commands = parseCommands ()
152
154
155
+ # At this point we have a list of all the commands and sub commands
156
+ # for each command create a Bash function
157
+ # register each subcommand
153
158
generateScript (commands )
154
-
155
- # At this point we have a list of all the commands and sub commands
156
- # for each command create a Bash function
157
- # register each subcommand
0 commit comments