def create_confirm_application(message):
 registry = Registry()
 @registry.add_binding(u'y')
 @registry.add_binding(u'Y')
 def _(event):
  event.cli.buffers[DEFAULT_BUFFER].text = u'y'
  event.cli.set_return_value(True)
 @registry.add_binding(u'n')
 @registry.add_binding(u'N')
 @registry.add_binding(Keys.ControlC)
 def _(event):
  event.cli.buffers[DEFAULT_BUFFER].text = u'n'
  event.cli.set_return_value(False)
 return create_prompt_application(message, key_bindings_registry=registry)

def create_confirm_application ( message ) : registry = Registry ( ) @ registry . add_binding ( u'y' ) @ registry . add_binding ( u'Y' ) def _ ( event ) : event . cli . buffers [ DEFAULT_BUFFER ] . text = u'y' event . cli . set_return_value ( True ) @ registry . add_binding ( u'n' ) @ registry . add_binding ( u'N' ) @ registry . add_binding ( Keys . ControlC ) def _ ( event ) : event . cli . buffers [ DEFAULT_BUFFER ] . text = u'n' event . cli . set_return_value ( False ) return create_prompt_application ( message , key_bindings_registry = registry )
create a confirmation application that returns true/false .