Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wobsoriano/rustybun
Readline implementation in Rust for Bun.
https://github.com/wobsoriano/rustybun
bun readline
Last synced: 2 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 (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-17T04:25:43.000Z (over 1 year ago)
- Last Synced: 2024-10-02T08:52:05.907Z (3 months 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