def _feed_cli_with_input(text, editing_mode=EditingMode.EMACS, clipboard=None, history=None, multiline=False, check_line_ending=True, pre_run_callback=None):
 if check_line_ending:
  assert text.endswith(u'\n')
 loop = PosixEventLoop()
 try:
  inp = PipeInput()
  inp.send_text(text)
  cli = CommandLineInterface(application=Application(buffer=Buffer(accept_action=AcceptAction.RETURN_DOCUMENT, history=history, is_multiline=multiline), editing_mode=editing_mode, clipboard=(clipboard or InMemoryClipboard()), key_bindings_registry=KeyBindingManager.for_prompt().registry), eventloop=loop, input=inp, output=DummyOutput())
  if pre_run_callback:
   pre_run_callback(cli)
  result = cli.run()
  return (result, cli)
 finally:
  loop.close()
  inp.close()

def _feed_cli_with_input ( text , editing_mode = EditingMode . EMACS , clipboard = None , history = None , multiline = False , check_line_ending = True , pre_run_callback = None ) : if check_line_ending : assert text . endswith ( u'\n' ) loop = PosixEventLoop ( ) try : inp = PipeInput ( ) inp . send_text ( text ) cli = CommandLineInterface ( application = Application ( buffer = Buffer ( accept_action = AcceptAction . RETURN_DOCUMENT , history = history , is_multiline = multiline ) , editing_mode = editing_mode , clipboard = ( clipboard or InMemoryClipboard ( ) ) , key_bindings_registry = KeyBindingManager . for_prompt ( ) . registry ) , eventloop = loop , input = inp , output = DummyOutput ( ) ) if pre_run_callback : pre_run_callback ( cli ) result = cli . run ( ) return ( result , cli ) finally : loop . close ( ) inp . close ( )
create a commandlineinterface .