summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorStefan Beller <stefanbeller@googlemail.com>2011-02-03 22:03:16 +0100
committerStefan Beller <stefanbeller@googlemail.com>2011-02-03 22:06:22 +0100
commitae8142bcd7b09e449e56c7fe8fc62079e150bcf0 (patch)
tree0101ac89abbb7c02647eaf9a187d49a3a5597ea0 /tools
parente9cadc76689c593bfd53e3b54f705b56e565a91b (diff)
downloadserverdata-ae8142bcd7b09e449e56c7fe8fc62079e150bcf0.tar.gz
serverdata-ae8142bcd7b09e449e56c7fe8fc62079e150bcf0.tar.bz2
serverdata-ae8142bcd7b09e449e56c7fe8fc62079e150bcf0.tar.xz
serverdata-ae8142bcd7b09e449e56c7fe8fc62079e150bcf0.zip
improve the showvariables tool
you can inspect only a singe file with parameter -f <file>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/showvars.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/tools/showvars.py b/tools/showvars.py
index 94ab3338..7e9c0625 100755
--- a/tools/showvars.py
+++ b/tools/showvars.py
@@ -8,7 +8,10 @@ import re
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-v", "--verbose", dest="verbose", action="store_true", default=False,
- help="show the occurrences of that var", metavar="FILE")
+ help="show the occurrences of that var")
+
+parser.add_option("-f", "--file", dest="fname", default="",
+ help="inspect that file", metavar="FILE")
(options, args) = parser.parse_args()
@@ -61,22 +64,20 @@ def handleFile(fname):
print "\tline:\t",line
return rm
+if options.fname:
+ path=options.fname
+else:
+ path=".."+os.sep+"npc"
+
allvars = {}
rmvars = []
print "please check manully for vars in here:"
-os.chdir(".."+os.sep+"npc")
+os.chdir(path)
for tpl in os.walk("."):
for fname in tpl[2]:
rmvars += handleFile(tpl[0]+os.sep+fname)
-# now check if the variable is not in npc/functions/clear_vars.txt, if so remove it
-#~ checkstring = "." + os.sep + "functions" + os.sep + "clear_vars.txt"
-#~ rm = []
-#~ for var in allvars:
- #~ if checkstring in allvars[var]:
- #~ rm += [var]
-
unusedcounter=0
usedcounter=0
print "These variables are found in the scripts, which are deleted in clear_vars"