0.0.4 • Published 7 months ago

@iohub/prompt v0.0.4

Weekly downloads
-
License
BSD
Repository
github
Last release
7 months ago

@iohub/prompt

Interactive CLI prompts for file system operations

npm version npm quality npm download npm total-download size github commit activity npm license

Features

  • Interactive file system selection with checkbox interface
  • Efficient filtering by extensions, files, or folders
  • Customizable page sizes for better UX
  • Zero dependencies for core functionality
  • Modern ES modules support
  • TypeScript-ready

Installation

# Using npm
npm install @iohub/prompt

# Using yarn
yarn add @iohub/prompt

# Using pnpm
pnpm add @iohub/prompt

Usage

import { promptExts, promptDocs, promptDirs } from '@iohub/prompt'

// Select files by extension
await promptExts('/path/to/source')
// Returns: string[] - Array of selected extensions
// Example: ['.js', '.ts', '.json']

// Select specific documents
await promptDocs('/path/to/source')
// Returns: string[] - Array of selected document paths
// Example: ['index.js', 'package.json']

// Select directories
await promptDirs('/path/to/source')
// Returns: string[] - Array of selected directory paths
// Example: ['src', 'test', 'dist']

API

promptExts(source: string)

Displays a checkbox prompt for selecting file extensions in the given source directory.

  • Page size: 12 items
  • Returns: Promise<string[]>

promptDocs(source: string)

Displays a checkbox prompt for selecting documents in the given source directory.

  • Page size: 24 items
  • Returns: Promise<string[]>

promptDirs(source: string)

Displays a checkbox prompt for selecting directories in the given source directory.

  • Page size: 18 items
  • Returns: Promise<string[]>

License

MIT © Hoyeung Wong