comparison python/tree.py @ 375:9314c1008189

aslightly better; still trouble at da end
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 24 Jul 2013 03:10:27 -0700
parents 6e0853b16457
children 3f84a96cccf6
comparison
equal deleted inserted replaced
374:6e0853b16457 375:9314c1008189
30 dirnames[:] = sorted(dirnames, key=lambda x: x.lower()) 30 dirnames[:] = sorted(dirnames, key=lambda x: x.lower())
31 directories[dirpath] = dirnames 31 directories[dirpath] = dirnames
32 retval.append('%s%s%s' % ('│' * (indent-1), 32 retval.append('%s%s%s' % ('│' * (indent-1),
33 '├' if indent else '', 33 '├' if indent else '',
34 os.path.basename(dirpath))) 34 os.path.basename(dirpath)))
35 filenames = sorted(filenames, key=lambda x: x.lower())
35 retval.extend(['%s%s%s' % ('│' * (indent), 36 retval.extend(['%s%s%s' % ('│' * (indent),
36 '├' if index < len(filenames) -1 else '└', 37 # '├' if (((index < len(filenames) -1)) or dirnames) else '└',
38 '├' if (((index < len(filenames) -1)) or dirnames) else '└',
37 name) 39 name)
38 for index, name in 40 for index, name in
39 enumerate(sorted(filenames, key=lambda x: x.lower())) 41 enumerate(filenames)
40 ]) 42 ])
41 return '\n'.join(retval) 43 return '\n'.join(retval)
42 44
43 def main(args=sys.argv[1:]): 45 def main(args=sys.argv[1:]):
44 46