Get askpass basically working

This commit is contained in:
Kovid Goyal
2022-03-10 22:11:37 +05:30
parent 3b724c8415
commit 61558d518e
3 changed files with 33 additions and 12 deletions

View File

@@ -74,7 +74,7 @@ class HistoryCompleter:
def option_text() -> str:
return '''\
--type -t
choices=line,yesno,choices
choices=line,yesno,choices,password
default=line
Type of input. Defaults to asking for a line of text.
@@ -361,6 +361,13 @@ def main(args: List[str]) -> Response:
loop.loop(handler)
return {'items': items, 'response': handler.response}
if cli_opts.type == 'password':
import getpass
if cli_opts.message:
print(styled(cli_opts.message, bold=True))
q = getpass.getpass()
return {'items': items, 'response': q or ''}
import readline as rl
readline = rl
from kitty.shell import init_readline