@@ -80,14 +80,15 @@ def checkFeatureList(optname, features, verbose=False):
80
80
if features :
81
81
for n in features :
82
82
if isValidFeature (n ) is True :
83
- if verbose :
84
- print ("valid " + optname + " feature: " + n )
83
+ #if verbose:
84
+ # print("valid " + optname + " feature: " + n)
85
+ pass
85
86
else :
86
87
print ("unknown " + optname + " feature: " + n )
87
88
return - 1
88
89
else :
89
- if verbose :
90
- print (optname + " is not specified" )
90
+ # if verbose:
91
+ # print(optname + " is not specified")
91
92
return 0
92
93
93
94
return len (features )
@@ -133,7 +134,7 @@ def writeConfig(path, buf):
133
134
else :
134
135
f .close ()
135
136
136
- def changeConfig (src , enabled , disabled ):
137
+ def changeConfig (src , enabled , disabled , verbose = False ):
137
138
dst = ""
138
139
regstart = re .compile (r'^\s*//\s*' + eyecatchBeginString )
139
140
regend = re .compile (r'^\s*//\s*' + eyecatchEndString )
@@ -168,10 +169,12 @@ def changeConfig(src, enabled, disabled):
168
169
break
169
170
if len (dstLine ) != 0 :
170
171
dst += dstLine
171
- print (dstLine .rstrip ())
172
+ if verbose :
173
+ print (dstLine .rstrip ())
172
174
else :
173
175
dst += line
174
- print (line .rstrip ())
176
+ if verbose :
177
+ print (line .rstrip ())
175
178
elif state == 2 :
176
179
dst += line
177
180
if state != 2 :
@@ -205,12 +208,12 @@ def main():
205
208
# Verification (whether or not to use "choice" with argparse)
206
209
numEnables = checkFeatureList ("-e" , enabledFeatures , verbose )
207
210
numDisables = checkFeatureList ("-d" , disabledFeatures , verbose )
208
- if verbose :
209
- print ("enables: " , numEnables )
210
- print (enabledFeatures )
211
- print ("disables: " , numDisables )
212
- print (disabledFeatures )
213
- print ("config file: " + configFilePath )
211
+ # if verbose:
212
+ # print("enables: ", numEnables)
213
+ # print(enabledFeatures)
214
+ # print("disables: ", numDisables)
215
+ # print(disabledFeatures)
216
+ # print("config file: " + configFilePath)
214
217
215
218
# Final checking about args
216
219
if numEnables < 0 or numDisables < 0 or (numEnables == 0 and numDisables == 0 ):
@@ -219,7 +222,8 @@ def main():
219
222
# Check if the target file exists
220
223
configFilePathAbs = os .path .abspath (configFilePath )
221
224
if verbose :
222
- print ("full path: " + configFilePathAbs )
225
+ print ("Config path: " + configFilePathAbs )
226
+ print ()
223
227
if not os .path .isfile (configFilePathAbs ):
224
228
print ("config file not found: " + configFilePathAbs )
225
229
sys .exit (255 )
@@ -228,7 +232,7 @@ def main():
228
232
src = readConfig (configFilePathAbs )
229
233
230
234
# Change the specified settings
231
- dst = changeConfig (src , enabledFeatures , disabledFeatures )
235
+ dst = changeConfig (src , enabledFeatures , disabledFeatures , verbose )
232
236
233
237
# Write back
234
238
writeConfig (configFilePathAbs , dst )
0 commit comments