0.2.0 • Published 12 months ago

bun-promptx v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

bun-promptx

bun-promptx is a terminal prompt library based on bubbles via bun:ffi.

Install

bun add bun-promptx

Usage

createSelection

The createSelection function lets you create a terminal single-selection list prompt. It provides the functions of page up and down and key movement, and supports custom rendering methods.

import { createSelection } from 'bun-promptx'

const result = createSelection([
  { text: 'feat', description: 'Introducing new features' },
  { text: 'fix', description: 'Bug fix' },
  { text: 'docs', description: 'Writing docs' },
  { text: 'style', description: 'Improving structure/format of the code' },
  { text: 'refactor', description: 'Refactoring code' },
  { text: 'test', description: 'Refactoring code' },
  { text: 'chore', description: 'When adding missing tests' },
  { text: 'perf', description: 'Improving performance' }
], {
  headerText: 'Select Commit Type: ',
  perPage: 5,
  footerText: 'Footer here'
})

console.log(result)
// { selectedIndex: 2, error: null }

createPrompt

The createPrompt function is a terminal input prompt library. It provides CJK character support and standard terminal shortcut keys (such as ctrl+a, ctrl+e), password input echo and other functions.

import { createPrompt } from 'bun-promptx'

const username = createPrompt("Enter username: ")
// { value: "wobsoriano", error: null }

const password = createPrompt("Enter password: ", {
  echoMode: 'password'
})
// { value: "123456", error: null }

License

MIT

0.2.0

12 months ago

0.1.9

1 year ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago