(con)
| 89 | |
| 90 | @contextmanager |
| 91 | def completer(con): |
| 92 | try: |
| 93 | import readline |
| 94 | except ImportError: |
| 95 | yield |
| 96 | return |
| 97 | |
| 98 | old_completer = readline.get_completer() |
| 99 | def complete(text, state): |
| 100 | return _complete(con, text, state) |
| 101 | try: |
| 102 | readline.set_completer(complete) |
| 103 | if readline.backend == "editline": |
| 104 | # libedit uses "^I" instead of "tab" |
| 105 | command_string = "bind ^I rl_complete" |
| 106 | else: |
| 107 | command_string = "tab: complete" |
| 108 | readline.parse_and_bind(command_string) |
| 109 | yield |
| 110 | finally: |
| 111 | readline.set_completer(old_completer) |
no test coverage detected
searching dependent graphs…