robin-rpr / inquirer-search-list

Inquirer.js Prompt to Fuzzy-Search a list of selectables 🔍
https://npmjs.com/package/inquirer-search-list
Other
31 stars 12 forks source link

inquirer.Separator is not supported #4

Open BenjaminVanRyseghem opened 2 years ago

BenjaminVanRyseghem commented 2 years ago

It doesn't look good, and when typing any character, it crashes

Screen Shot 2021-08-30 at 16 08 29
choices: [
    "Pepperoni",
    "Ham",
    "Ground Meat",
    "Bacon",
    new inquirer.Separator(),
    "Mozzarella",
    "Bottle"
],
wangrongding commented 1 year ago

That's how I'm handling it for now.

inquirer
  .prompt([
    {
      type: 'search-list',
      message: 'xxxx',
      name: 'xxxx',
      choices: docList.map((item) => {
        // 👇👇👇👇👇
        if (item.line || item.type) {
          item.name = item.line
          item.value = false
          delete item.line
          delete item.type
        }
        return item
      }),
      validate: (answer) => !!answer,
    },
  ])