πŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more β†’
Socket
Sign inDemoInstall
Socket

inquirer-file-selector

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inquirer-file-selector

Inquerer file selector prompt.

0.2.0
Source
npm
Version published
Weekly downloads
7.7K
-9.05%
Maintainers
0
Weekly downloads
Β 
Created
Source

inquirer-file-selector

An file selector prompt implementation for Inquirer.js.

license node-current version unpacked-size downloads

preview

Installation

npm install inquirer-file-selector

Usage

import fileSelector from 'inquirer-file-selector'

const filePath = await fileSelector({
  message: 'Select a file:',
  ...
})

Options

OptionTypeRequiredDescription
messagestringβœ”The message to display in the prompt.
pathstringThe path to the directory where it will be started.
Default: process.cwd()
pageSizenumberThe maximum number of items to display in the list.
Default: 10
extensionsstring[]The extensions to filter the files.
Default: []
disabledLabelstringThe label to display when a file is disabled.
Default: (not allowed)
noFilesFoundstringThe message to display when no files are found.
Default: No files found
themeSee ThemingThe theme to use for the file selector.

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 FileSelectorTheme = {
  icon: {
    /**
     * The prefix to use for the line.
     * @default isLast => isLast ? └── : β”œβ”€β”€
     */
    linePrefix: (isLast: boolean) => string
  }
  style: {
    /**
     * The style to use for the disabled items.
     * @default chalk.dim
     */
    disabled: (text: string) => string
    /**
     * The style to use for the active item.
     * @default chalk.cyan
     */
    active: (text: string) => string
    /**
     * The style to use for the no files found message.
     * @default chalk.red
     */
    noFilesFound: (text: string) => string
    /**
     * The style to use for items of type directory.
     * @default chalk.yellow
     */
    directory: (text: string) => string
    /**
     * The style to use for items of type file.
     * @default chalk.white
     */
    file: (text: string) => string
    /**
     * The style to use for the current directory header.
     * @default chalk.magenta
     */
    currentDir: (text: string) => string
    /**
     * The style to use for the key bindings help.
     * @default chalk.white
     */
    help: (text: string) => string
    /**
     * The style to use for the keys in the key bindings help.
     * @default chalk.cyan
     */
    key: (text: string) => string
  }
}

Β© 2024 Brian Fernandez

This project is licensed under the MIT license. See the file LICENSE for details.

Keywords

inquirer

FAQs

Package last updated on 30 Jul 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