creates a console prompt and calls the passed callback with the anwser
486478
function (message, config, cb) {
        if(typeof config === 'function') {
            cb = config;
            config = {};
        }
        var stdin = config.stdin || process.stdin,
            stdout = config.stdout || process.stdout,
            prompt = config.prompt || '\u203A';
        stdout.write('  ' + message + '\n  ' + prompt + ' ');
        stdin.resume();
        stdin.setEncoding('utf8');
        stdin.on('data', function (text) {
            text = text.trim().replace(/\r\n|\n/, '');
            cb(text);
        });
    }
1090868
def do_interact(self, arg):
        
        def readfunc(prompt):
            self.stdout.write(prompt)
            self.stdout.flush()
            line = self.stdin.readline()
            line = line.rstrip('\r\n')
            if line == 'EOF':
                raise EOFError
            return line

        ns = self.curframe.f_globals.copy()
        ns.update(self.get_locals(self.curframe))
        if isinstance(self.stdin, RemoteSocket):
            # Main interpreter redirection of the code module.
            if PY3:
                import sys as _sys
            else:
                # Parent module 'pdb_clone' not found while handling absolute
                # import.
                _sys = __import__('sys', level=0)
            code.sys = _sys
            self.redirect(code.interact, local=ns, readfunc=readfunc)
        else:
            code.interact("*interactive*", local=ns)
1044611
def make_call_with_cb(self, fun, *args):
        """"""

        cid, event = self.handler.register_callback()
        argscp = list(args)
        argscp.append(cid)
        self.make_call(fun, *argscp)
        return event
1120565
def callback_handler_install(self, prompt, callback):
        
        '''
        self.callback = callback
        self.readline_setup(prompt)
168153
function fillInit() {
    console.log('\nThis utility will generate a resume.json file in your current working directory.');
    console.log('Fill out your name and email to get started, or leave the fields blank.');
    console.log('All fields are optional.\n');
    console.log('Press ^C at any time to quit.');

    read({
        prompt: 'name: '
    }, function(er, name) {
        if (er) {
            console.log();
            process.exit();
        }

        read({
            prompt: 'email: '
        }, function(er, email) {
            if (er) {
                console.log();
                process.exit();
            }

            resumeJson.basics.name = name;
            resumeJson.basics.email = email;

            fs.writeFileSync(process.cwd() + '/resume.json', JSON.stringify(resumeJson, undefined, 2));

            console.log('\nYour resume.json has been created!'.green);
            console.log('');
            console.log('To generate a formatted .html .md .txt or .pdf resume from your resume.json');
            console.log('type: `resume export [someFileName]` including file extension eg: `resume export myresume.html`');
            console.log('\nYou can optionally specify an available theme for html and pdf resumes using the --theme flag.');
            console.log('Example: `resume export myresume.pdf --theme flat`');
            console.log('Or simply type: `resume export` and follow the prompts.');
            console.log('');

            process.exit();
            callback(true);
        });
    });
}
22749
function hook_stdout(callback) {
        var old_write;
        var useProcess;
        if(typeof(process)!=="undefined") {
            old_write = process.stdout.write;
            useProcess = true;
            process.stdout.write = (function(write) {
                return function(string, encoding, fd) {
                    write.apply(process.stdout, arguments);
                    callback(string, encoding, fd);
                };
            })(old_write);
        }
        else {
            old_write = console.log.bind(console);
            useProcess = false;
            console.log = (function(write) {
                return function(string) {
                    write.apply(string);
                    callback(string, "utf8");
                };
            })(old_write);
        }
        return function() {
            if(useProcess) {
                process.stdout.write = old_write;
            }
            else {
                console.log = old_write;
            }
        };
    }
621932
function ShellCraft() {
  var self = this;

  var ArgumentsList = require('./lib/argumentslist.js');
  var Prompt = require('./lib/prompt.js');

  self._exit = false;
  self._shell = true; /* open the shell be default */
  self._scope = 'global';

  self.arguments = new ArgumentsList();
  self.arguments._add(
    'exit',
    new Command(
      function(callback) {
        self._exit = true;
        if (callback) {
          callback();
        }
      },
      {builtIn: true, scope: '*'},
      'exit the shell'
    )
  );

  self.arguments._add(
    'help',
    new Command(
      function(callback) {
        Object.keys(Object.getPrototypeOf(self.arguments)).forEach(function(
          fct
        ) {
          if (
            !self.arguments.hasOwnProperty(fct) &&
            !/^_/.test(fct) &&
            self.arguments[fct].type() === 'command' &&
            self.arguments[fct].isScoped(self._scope)
          ) {
            console.log(self.arguments[fct].help());
          }
        });

        console.log('');

        if (callback) {
          callback();
        }
      },
      {builtIn: true, scope: '*'},
      'list of commands'
    )
  );

  self.arguments._add(
    'scope',
    new Command(
      function(callback, scope) {
        self._scope = scope[0] || 'global';
        self.autocomplete.reload();
        self.prompt.setScope(self._scope !== 'global' ? scope : '');

        if (callback) {
          callback();
        }
      },
      {
        builtIn: true,
        scope: '*',
        params: {
          optional: 'scope',
        },
      },
      function() {
        var help = 'change scope';
        var scopes = [];

        /* Look for all available scopes */
        Object.keys(Object.getPrototypeOf(self.arguments)).forEach(function(
          fct
        ) {
          if (
            !self.arguments.hasOwnProperty(fct) &&
            !/^_/.test(fct) &&
            self.arguments[fct].type() === 'command'
          ) {
            var scope = self.arguments[fct].scope();
            if (scope === '*' || scope === 'global') {
              return;
            }

            if (scopes.indexOf(scope) === -1) {
              scopes.push(self.arguments[fct].scope());
            }
          }
        });

        var list = scopes.length ? ' (' + scopes.join(', ') + ')' : '';
        return help + list;
      }
    )
  );

  self.options = {
    version: '0.0.1',
  };
  self.prompt = new Prompt();
  self.extensions = {};

  /* HACK inquirer prefix */
  Object.keys(inquirer.prompt.prompts).forEach(function(prompt) {
    inquirer.prompt.prompts[prompt].prototype.getQuestion = function() {
      var msg = inquirer.prompt.prompts[
        prompt
      ].super_.prototype.getQuestion.bind(this)();
      return msg.replace(/[^ ]*\?[^ ]* /, '');
    };
  });
}
620243
def run(self):
    """"""
    if platform.system() == 'Windows':
      # Windows doesn't support file-like objects for select(), so fall back
      # to raw_input().
      response = input(''.join((self._message,
                                os.linesep,
                                PROMPT)))
      self._answered = True
      self._callback(response)
      return

    # First, display the prompt to the console.
    console_output.cli_print(self._message, color=self._color,
                             end=os.linesep, logger=None)
    console_output.cli_print(PROMPT, color=self._color, end='', logger=None)
    sys.stdout.flush()

    # Before reading, clear any lingering buffered terminal input.
    termios.tcflush(sys.stdin, termios.TCIFLUSH)

    line = ''
    while not self._stop_event.is_set():
      inputs, _, _ = select.select([sys.stdin], [], [], 0.001)
      if sys.stdin in inputs:
        new = os.read(sys.stdin.fileno(), 1024)
        if not new:
          # Hit EOF!
          # They hit ^D (to insert EOF). Tell them to hit ^C if they
          # want to actually quit.
          print('Hit ^C (Ctrl+c) to exit.')
          break
        line += new.decode('utf-8')
        if '\n' in line:
          response = line[:line.find('\n')]
          self._answered = True
          self._callback(response)
          return
452921
def prompt(text, default=None, show_default=True, invisible=False,
           confirm=False, skip=False, type=None, input_function=None):
	'''
	'''
	t = determine_type(type, default)
	input_function = get_input_fn(input_function, invisible)
	if default is not None and show_default:
		text = '{} [{}]: '.format(text, default)
	while True:
		val = prompt_fn(input_function, text, default, t, skip, repeat=True)
		if not confirm or (skip and val is None):
			return val
		if val == prompt_fn(input_function, 'Confirm: ', default, t, repeat=True):
			return val
		echo('Error: The two values you entered do not match', True)
12287
def prompt(self, msg):
        """"""
        try:
            # prompt_toolkit v2
            prompt = prompt_toolkit.PromptSession(history=self.history).prompt
        except AttributeError:
            # prompt_toolkit v1
            prompt = partial(prompt_toolkit.prompt, history=self.history)
        return prompt(
            msg,
            multiline=self.multiline,
            vi_mode=self.vi_mode,
            wrap_lines=self.wrap_lines,
            enable_history_search=self.history_search,
            lexer=PygmentsLexer(CoconutLexer),
            style=style_from_pygments_cls(
                pygments.styles.get_style_by_name(self.style),
            ),
        )
213363
def _prompt_wrapper(message, default=None, validator=None):
    

    class MockDocument:

        def __init__(self, text):
            self.text = text

    if HAS_INPUT:
        ret = prompt(message, default=default, validator=validator)
    else:
        ret = sys.stdin.readline().strip()
        print(message, ret)
        if validator:
            validator.validate(MockDocument(ret))
    if "q" in ret:
        if not HAS_OUTPUT:
            print("User exit")
        sys.exit("User exit")
    return ret
967363
def callback(params, returns, &block)
      Win32::API::Callback.new(params, returns, &block)
    end
928148
def make_dynamic_prompt(self, prompt):
        """"""
        if prompt:
            self.prompt_re = self.driver.make_dynamic_prompt(prompt)
781426
def onStart(self):
        
        curses.mousemask(0)
        self.paths.host_config()
        version = Version()

        # setup initial runtime stuff
        if self.first_time[0] and self.first_time[1] != 'exists':
            system = System()
            thr = Thread(target=system.start, args=(), kwargs={})
            thr.start()
            countdown = 60
            while thr.is_alive():
                npyscreen.notify_wait('Completing initialization:...' + str(countdown),
                                      title='Setting up things...')
                time.sleep(1)
                countdown -= 1
            thr.join()

        quit_s = '\t'*4 + '^Q to quit'
        tab_esc = '\t'*4 + 'ESC to close menu popup'
        self.addForm('MAIN',
                     MainForm,
                     name='Vent ' + version +
                     '\t\t\t\t\t^T for help' + quit_s + tab_esc,
                     color='IMPORTANT')
        self.addForm('HELP',
                     HelpForm,
                     name='Help\t\t\t\t\t\t\t\t^T to toggle previous' +
                     quit_s,
                     color='DANGER')
        self.addForm('TUTORIALINTRO',
                     TutorialIntroForm,
                     name='Vent Tutorial' + quit_s,
                     color='DANGER')
        self.addForm('TUTORIALBACKGROUND',
                     TutorialBackgroundForm,
                     name='About Vent' + quit_s,
                     color='DANGER')
        self.addForm('TUTORIALTERMINOLOGY',
                     TutorialTerminologyForm,
                     name='About Vent' + quit_s,
                     color='DANGER')
        self.addForm('TUTORIALGETTINGSETUP',
                     TutorialGettingSetupForm,
                     name='About Vent' + quit_s,
                     color='DANGER')
        self.addForm('TUTORIALSTARTINGCORES',
                     TutorialStartingCoresForm,
                     name='Working with Cores' + quit_s,
                     color='DANGER')
        self.addForm('TUTORIALADDINGPLUGINS',
                     TutorialAddingPluginsForm,
                     name='Working with Plugins' + quit_s,
                     color='DANGER')
        self.addForm('TUTORIALADDINGFILES',
                     TutorialAddingFilesForm,
                     name='Files' + quit_s,
                     color='DANGER')
        self.addForm('TUTORIALTROUBLESHOOTING',
                     TutorialTroubleshootingForm,
                     name='Troubleshooting' + quit_s,
                     color='DANGER')
1290018
def _create_console_handles(self, project):
        
        """
        import __main__
        for item in project:
            __main__.__dict__[item.name] = item
464541
function Console() {
        this.mode = LiteGraph.ON_EVENT;
        this.size = [80, 30];
        this.addProperty("msg", "");
        this.addInput("log", LiteGraph.EVENT);
        this.addInput("msg", 0);
    }
13521
function Prompt({ message, when = true }) {
  return (
    <RouterContext.Consumer>
      {context => {
        invariant(context, "You should not use <Prompt> outside a <Router>");

        if (!when || context.staticContext) return null;

        const method = context.history.block;

        return (
          <Lifecycle
            onMount={self => {
              self.release = method(message);
            }}
            onUpdate={(self, prevProps) => {
              if (prevProps.message !== message) {
                self.release();
                self.release = method(message);
              }
            }}
            onUnmount={self => {
              self.release();
            }}
            message={message}
          />
        );
      }}
    </RouterContext.Consumer>
  );
}