Skip to content

Commit b680aa7

Browse files
committed
slightly more PEP8 compliant
1 parent 558a222 commit b680aa7

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

tools/bash_completion/generator.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
# Top level --version is a pain to deal with so ignoring for now
1010
# 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 ]*)$"
1212

1313
# Why the hell do spaces get regexed in command1 ?
1414
subcommandRegex = r"^\s+(?P<command1>-+[a-zA-Z_\-]+(?P<modifier1>\s+[A-Z_\-]+)?)"\
@@ -70,29 +70,32 @@ def parseCommands():
7070
command2.strip()
7171
command2 = command2.split()[0]
7272

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
7475
commandMatch["command1"] = command1
7576
commandMatch["command2"] = command2
76-
77+
7778
commands[commandKey]["subcommands"].append(commandMatch)
78-
79+
7980
# Push format for mustache
8081
if command1 and '--' in command1:
81-
commands[commandKey]["DDASH_COMMANDS"].append({"name": command1})
82+
commands[commandKey]["DDASH_COMMANDS"].append(
83+
{"name": command1})
8284
if command2 and '--' in command2:
83-
commands[commandKey]["DDASH_COMMANDS"].append({"name": command2})
85+
commands[commandKey]["DDASH_COMMANDS"].append(
86+
{"name": command2})
8487

8588
if command1:
8689
m = re.match("^-[a-zA-Z]{1,2}", command1)
8790
if m:
88-
commands[commandKey]["DASH_COMMANDS"].append({"name": command1})
89-
91+
commands[commandKey]["DASH_COMMANDS"].append(
92+
{"name": command1})
93+
9094
if command2:
9195
m = re.match("^-[a-zA-Z]{1,2}", command2)
9296
if m:
93-
commands[commandKey]["DASH_COMMANDS"].append({"name": command2})
94-
95-
#print command1, command2
97+
commands[commandKey]["DASH_COMMANDS"].append(
98+
{"name": command2})
9699

97100
return commands
98101

@@ -126,7 +129,6 @@ def generateCompleters(commands):
126129

127130

128131
def generateBoilerPlate(commands):
129-
tmplt = ""
130132
txt = []
131133

132134
with open("templates/boilerplate.tmplt") as fp:
@@ -150,8 +152,7 @@ def generateScript(commands):
150152
if __name__ == '__main__':
151153
commands = parseCommands()
152154

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
153158
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

Comments
 (0)