tests/list-tree.py
changeset 43076 2372284d9457
parent 35389 acff41957b34
child 48966 6000f5b25c9b
equal deleted inserted replaced
43075:57875cf423c9 43076:2372284d9457
     7 import os
     7 import os
     8 
     8 
     9 ap = argparse.ArgumentParser()
     9 ap = argparse.ArgumentParser()
    10 ap.add_argument('path', nargs='+')
    10 ap.add_argument('path', nargs='+')
    11 opts = ap.parse_args()
    11 opts = ap.parse_args()
       
    12 
    12 
    13 
    13 def gather():
    14 def gather():
    14     for p in opts.path:
    15     for p in opts.path:
    15         if not os.path.exists(p):
    16         if not os.path.exists(p):
    16             return
    17             return
    22                 for f in files:
    23                 for f in files:
    23                     yield os.path.join(dirpath, f)
    24                     yield os.path.join(dirpath, f)
    24         else:
    25         else:
    25             yield p
    26             yield p
    26 
    27 
       
    28 
    27 print('\n'.join(sorted(gather(), key=lambda x: x.replace(os.path.sep, '/'))))
    29 print('\n'.join(sorted(gather(), key=lambda x: x.replace(os.path.sep, '/'))))