How to use the blessed.prompt function in blessed

To help you get started, we’ve selected a few blessed examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ewnd9 / badtaste / src / tui / vk-prompt.js View on Github external
export default (screen, cb) => {
  const prompt = blessed.prompt({
    parent: screen,
    border: 'line',
    height: 'shrink',
    width: 'half',
    top: 'center',
    left: 'center',
    label: ' {blue-fg}Question{/blue-fg} ',
    tags: true,
    keys: true,
    vi: true,
    hidden: false
  });

  prompt.input('insert vk user or community url', '', (err, value) => {
    const alias = value.split('vk.com/')[1];
    return vk.method('utils.resolveScreenName', { screen_name: alias }).then((apiResponse) => {
github mkaminsky11 / imgurize / lib / imgurize.js View on Github external
screen.key('s', function(ch, key){
  var prompt = blessed.prompt({
    vi: true,
    keys: true
  });

  screen.append(prompt);
  prompt.input("Input search term","", function(err, value){
    user_mode = false;
    search_mode = true;
    _search = value;
    title_text.setContent("imgurize | " + ("search: " + _search).white);
    init();

    screen.remove(prompt);
    screen.render();
  });
});
github gistia / json-log-viewer / src / widgets / MainPanel.js View on Github external
prompt(str, value, callback) {
    const prompt = blessed.prompt({
      parent: this,
      border: 'line',
      height: 'shrink',
      width: 'half',
      top: 'center',
      left: 'center',
      label: ' {blue-fg}Prompt{/blue-fg} ',
      tags: true,
      keys: true,
      vi: true,
      padding: 1,
    });

    prompt.input(str, value || '', (err, value) => {
      if (err) { return; }
      if (value) {
github radareorg / radare2-extras / blessr2 / index.js View on Github external
function uiQuestion(title, text, cb) {
    var question = blessed.prompt({
        parent: screen,
        border: config.border,
        height: 'shrink',
        width: 'half',
        top: 'center',
        left: 'center',
        label: title,
        tags: true,
        keys: true,
        vi: true
    });
    question.input('\n  ' + text, (err, val) => {
        question.destroy();
        screen.render();
        if (!err && val) {
            cb(val);
github chjj / termcoin / lib / ui.js View on Github external
tabs.debug._.data = blessed.text({
      parent: tabs.debug,
      top: 0,
      left: 3,
      height: 'shrink',
      width: 'shrink',
      content: '',
      tags: true
    });
  }

  /**
   * Global Widgets
   */

  screen._.prompt = blessed.prompt({
    parent: screen,
    top: 'center',
    left: 'center',
    height: 'shrink',
    width: 'shrink',
    keys: true,
    vi: true,
    mouse: true,
    tags: true,
    content: 'Label:',
    border: 'line',
    hidden: true
  });

  screen._.prompt._.input.key('C-e', function() {
    if (!screen.focused || screen.focused !== screen._.prompt._.input) {
github shobrook / BitVision / bitvision / interface / transaction.js View on Github external
function createPrompt(screen, popupLabel) {
  return blessed.prompt({
    parent: screen,
    border: "line",
    height: 9,
    width: 45,
    top: "center",
    left: "center",
    label: popupLabel,
    tags: true,
    keys: true,
    style: {
      fg: "blue",
      bg: colors.background,
      border: {
        fg: "light-green"
      }
    }
github gistia / json-log-viewer / src / browser.js View on Github external
constructor(screen, rawData, _blessed=require('blessed'), Table=require('./widgets/table')) {
    this.blessed = _blessed;
    this.screen = screen;
    this.rawData = rawData.reverse();
    this.jsonMode = false;

    const def = this.parseData();
    const prompt = blessed.prompt({
      parent: screen,
      top: 'center',
      left: 'center',
      height: 'shrink',
      width: 'shrink',
      keys: true,
      vi: true,
      mouse: true,
      tags: true,
      border: 'line',
      hidden: true,
    });

    const table = Table({
      keys: true,
      fg: 'white',
github infinitered / reactotron / legacy / reactotron-cli / src / ui / layout.js View on Github external
import blessed from 'blessed'

const screen = blessed.screen({
  smartCSR: true,
  title: 'reactotron',
  dockBorders: false,
  fullUnicode: true
})

const promptBox = blessed.prompt({
  parent: screen,
  top: 'center',
  left: 'center',
  height: 'shrink',
  width: 'shrink',
  border: 'line',
  label: ' {blue-fg}Prompt{/} ',
  tags: true,
  keys: true,
  mouse: true,
  hidden: true
})

const messageBox = blessed.message({
  parent: screen,
  top: 'center',