https://github.com/wobsoriano/rustybun
Readline implementation in Rust for Bun.
https://github.com/wobsoriano/rustybun
bun readline
Last synced: 9 months ago
JSON representation
Readline implementation in Rust for Bun.
- Host: GitHub
- URL: https://github.com/wobsoriano/rustybun
- Owner: wobsoriano
- License: mit
- Created: 2022-08-02T17:24:32.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-05-17T04:25:43.000Z (about 3 years ago)
- Last Synced: 2025-04-15T02:18:51.804Z (about 1 year ago)
- Topics: bun, readline
- Language: Rust
- Homepage:
- Size: 377 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RustyBun
Readline implementation in Rust for Bun. [RustyLine](https://github.com/kkawakam/rustyline) Bun ffi wrapper.
## Install
```bash
bun add rustybun
```
## Usage
```js
import RustyBun from 'rustybun'
const rb = new RustyBun()
const { success } = rb.loadHistory('history.txt')
if (!success) {
console.log('No previous history.')
}
while (true) {
const line = rb.readline();
if (line.signal === 'CtrlC') {
console.log('CtrlC')
break
}
if (line.signal === 'CtrlD') {
console.log('CtrlD')
break
}
console.log(line.value)
}
rb.saveHistory('history.txt')
```
## License
MIT