New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

inquirer-toggle

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inquirer-toggle

Simple interactive command line prompt to gather boolean input from users. Inspired by [prompts](https://www.npmjs.com/package/prompts#togglemessage-initial-active-inactive).

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11K
decreased by-2.3%
Maintainers
1
Weekly downloads
 
Created
Source

inquirer-toggle

Simple interactive command line prompt to gather boolean input from users. Inspired by prompts.

Toggle prompt

Installation

npm install inquirer-toggle

yarn add inquirer-toggle

Usage

import toggle from 'inquirer-toggle';

const answer = await toggle({ message: 'Continue?' });

Options

PropertyTypeRequiredDefaultDescription
messagestringyes-The question to be displayed to the user.
defaultbooleannofalseThe default answer when the user doesn't provide one.
themeObjectno-An object to customize the look of the prompt.
theme.activestringno"yes"The text to display for the active part of the toggle.
theme.inactivestringno"no"The text to display for the inactive part of the toggle.
theme.prefixstringnochalk.green('?')The prefix to display before the message.
theme.styleObjectno-An object to customize the styles of the prompt.
theme.style.message(string) => stringnochalk.boldA function to style the message.
theme.style.answer(string) => stringnochalk.cyanA function to style the answer.
theme.style.highlight(string) => stringnochalk.cyanA function to style the highlighted user selection.

Theming

You can theme a prompt by passing a theme object option. The theme object only need to includes the keys you wish to modify, we'll fallback on the defaults for the rest.

type Theme = {
    message: string;
    default?: boolean;
    theme?: {
        active?: string;
        inactive?: string;
        prefix?: Theme["prefix"];
        style?: {
            message?: Theme["style"]["message"];
            answer?: Theme["style"]["answer"];
            highlight?: Theme["style"]["highlight"];
        }
    };
};

License

Copyright (c) 2024 Sertac Karahoda
Licensed under the MIT license.

FAQs

Package last updated on 22 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc