| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 | #!/usr/bin/python# PYTHON_ARGCOMPLETE_OKimport osex.locateimport sysimport localeimport argparseimport argcompleteimport ioex.cursesexdef _init_argparser():    argparser = argparse.ArgumentParser(description = None)    argparser.add_argument('--database-path')    argparser.add_argument('--ignore-case', action='store_true')    argparser.add_argument('--match-all', action='store_true')    argparser.add_argument('--multiple', action='store_true')    argparser.add_argument('--update-database', action='store_true')    argparser.add_argument('--update-require-visibility', choices = ['yes', 'no'])    argparser.add_argument('patterns', metavar = 'pattern', nargs = '+')    return argparserdef main(argv):    argparser = _init_argparser()    argcomplete.autocomplete(argparser)    args = argparser.parse_args(argv)    params = vars(args)    if args.update_require_visibility == 'yes':        args.update_require_visibility = True    elif args.update_require_visibility == 'no':        args.update_require_visibility = False    paths = ioex.cursesex.tty_wrapper(osex.locate.locate_select, **vars(args))    if paths is None:        return 1    else:        print('\n'.join(paths).encode(locale.getpreferredencoding()))        return 0if __name__ == "__main__":    sys.exit(main(sys.argv[1:]))
 |