diff options
author | Stefan Beller <stefanbeller@googlemail.com> | 2011-02-03 22:03:16 +0100 |
---|---|---|
committer | Stefan Beller <stefanbeller@googlemail.com> | 2011-02-03 22:06:22 +0100 |
commit | d3867809162ae03c93a71c6606ff87baba2074dc (patch) | |
tree | 40b39f5f57fb640412818a408cf06a269c4c4c10 /showvars.py | |
parent | c7a427e1754ac9ed7f2f229605cd4fd5c7500e4c (diff) | |
download | tools-d3867809162ae03c93a71c6606ff87baba2074dc.tar.gz tools-d3867809162ae03c93a71c6606ff87baba2074dc.tar.bz2 tools-d3867809162ae03c93a71c6606ff87baba2074dc.tar.xz tools-d3867809162ae03c93a71c6606ff87baba2074dc.zip |
improve the showvariables tool
you can inspect only a singe file with parameter -f <file>
Diffstat (limited to 'showvars.py')
-rwxr-xr-x | showvars.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/showvars.py b/showvars.py index 94ab333..7e9c062 100755 --- a/showvars.py +++ b/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" |