select-line 698 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/python
  2. # PYTHON_ARGCOMPLETE_OK
  3. import ioex.selector
  4. import ioex.cursesex
  5. import os
  6. import sys
  7. import argparse
  8. import argcomplete
  9. def _init_argparser():
  10. argparser = argparse.ArgumentParser(description = None)
  11. argparser.add_argument("--multiple", action = "store_true")
  12. return argparser
  13. def main(argv):
  14. argparser = _init_argparser()
  15. argcomplete.autocomplete(argparser)
  16. args = argparser.parse_args(argv)
  17. lines = [l.strip() for l in sys.stdin]
  18. selected_lines = ioex.cursesex.tty_wrapper(ioex.selector.select_string, lines, args.multiple)
  19. print('\n'.join(selected_lines))
  20. return 0
  21. if __name__ == "__main__":
  22. sys.exit(main(sys.argv[1:]))