| 407 | 1 #!/usr/bin/env python | 
|  | 2 | 
|  | 3 """ | 
|  | 4 ls unique file paths | 
|  | 5 """ | 
|  | 6 | 
|  | 7 import optparse | 
|  | 8 import os | 
|  | 9 import sys | 
|  | 10 | 
|  | 11 here = os.path.dirname(os.path.realpath(__file__)) | 
|  | 12 | 
|  | 13 def main(args=sys.argv[1:]): | 
|  | 14 | 
|  | 15     usage = '%prog [options]' | 
|  | 16     parser = optparse.OptionParser(usage=usage, description=__doc__) | 
|  | 17     parser.add_option('--strip', default='? ') | 
|  | 18     options, args = parser.parse_args(args) | 
|  | 19 | 
|  | 20     _input = sys.stdin.read() | 
|  | 21     lines = [i.strip() for i in _input.splitlines() | 
|  | 22              if i.strip()] | 
|  | 23     lines = [i[len(options.strip):] if i.startswith(options.strip) else i | 
|  | 24              for i in lines] | 
|  | 25     paths = set([i.split(os.path.sep)[0] for i in lines]) | 
|  | 26     for i in sorted(paths): | 
|  | 27         print i | 
|  | 28 | 
|  | 29 if __name__ == '__main__': | 
|  | 30     main() |