From ae8142bcd7b09e449e56c7fe8fc62079e150bcf0 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Thu, 3 Feb 2011 22:03:16 +0100 Subject: improve the showvariables tool you can inspect only a singe file with parameter -f --- tools/showvars.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'tools/showvars.py') 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" -- cgit v1.2.3-60-g2f50