Skip to content

Commit

Permalink
daniel/reedline history (#26)
Browse files Browse the repository at this point in the history
* integrate with reedline history

* add reedline source

* remove reedline
;

* add reedline source again

* expose ReadlineError

* use reedline reuslt

* refactor context and runtime
  • Loading branch information
MrPicklePinosaur authored Mar 1, 2023
1 parent aa05667 commit 9751132
Show file tree
Hide file tree
Showing 98 changed files with 16,277 additions and 175 deletions.
416 changes: 375 additions & 41 deletions Cargo.lock

Large diffs are not rendered by default.

37 changes: 5 additions & 32 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,32 +1,5 @@
[package]
name = "shrs"
version = "0.1.0"
edition = "2021"
license = "MIT OR Apache-2.0"
authors = ["MrPicklePinosaur"]
description = "modular library to build your own shell in rust"
repository = "https://github.com/MrPicklePinosaur/sh.rs"
build = "build.rs"

[dependencies]
lalrpop-util = { version = "0.19.8", features = ["lexer"] }
regex = "1"
signal-hook = "0.3"
crossbeam-channel = "0.5"
clap = { version = "4.1", features = ["derive"] }

reedline = "0.16"

pino_deref = "0.1"

thiserror = "1"
anyhow = "1"

[dev-dependencies]
rexpect = "0.5"

[build-dependencies]
lalrpop = { version = "0.19.8", features = ["lexer"] }

[[example]]
name = "simple"
[workspace]
members = [
"shrs_lib",
"reedline"
]
21 changes: 21 additions & 0 deletions reedline/.github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Bug report
about: Something doesn't work as expected or is broken
title: ''
labels: bug
assignees: ''

---

**Platform** e.g. macOS, Windows 10, ...
**Terminal software** e.g. gnome-terminal, Apple Terminal.app, ...

Describe the problem you are observing.

## Steps to reproduce
1. minimal posssible steps necessary
2. to cause the problem

## Screenshots/Screencaptures

Very helpful if the display doesn't seem to work
14 changes: 14 additions & 0 deletions reedline/.github/ISSUE_TEMPLATE/missing-feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Missing feature
about: Suggest an idea for reedline
title: ''
labels: enhancement
assignees: ''

---

Let us know about features you really want to see in reedline.

## References

If the feature you are interested in exists in other shells or terminal editors, please share links to documentation or screenshots to easily communicate the desired behavior!
65 changes: 65 additions & 0 deletions reedline/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
on:
pull_request:
push: # Run CI on the main branch after every merge. This is important to fill the GitHub Actions cache in a way that pull requests can see it
branches:
- main

name: continuous-integration

jobs:
build-lint-test:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest]
rust:
- stable
# Define the feature sets that will be built here (for caching you define a separate name)
style: [bashisms, default, sqlite, basqlite, external_printer]
include:
- style: bashisms
flags: "--features bashisms"
- style: external_printer
flags: "--features external_printer"
- style: default
flags: ""
- style: sqlite
flags: "--features sqlite"
- style: basqlite
flags: "--features bashisms,sqlite"

runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v3

- name: Setup Rust toolchain
uses: actions-rust-lang/[email protected]

- name: Setup nextest
uses: taiki-e/install-action@nextest

- name: Rustfmt
uses: actions-rs/[email protected]
with:
command: fmt
args: --all -- --check

- name: Clippy
uses: actions-rs/[email protected]
with:
command: clippy
args: ${{ matrix.flags }} --all -- -D warnings


- name: Tests
uses: actions-rs/[email protected]
with:
command: nextest
args: run --all ${{ matrix.flags }}

- name: Doctests
uses: actions-rs/[email protected]
with:
command: test
args: --doc ${{ matrix.flags }}
11 changes: 11 additions & 0 deletions reedline/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
target/
history.txt
history.sqlite3*
.DS_Store
target-coverage/
tarpaulin-report.html
.vscode
.helix

# ignore the git mailmap file
.mailmap
53 changes: 53 additions & 0 deletions reedline/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Contributing

reedline's development is primarily driven by the [nushell project](https://github.com/nushell) at the moment to provide its interactive REPL.
Our goal is to explore options for a pleasant interaction with a shell and programming language.
While the maintainers might currently prioritize working on features for nushell, we are open to ideas and contributions by people and projects interested in using reedline for other projects.
Feel free to open an [issue](https://github.com/nushell/reedline/issues/new/choose) or chat with us on the [nushell discord](https://discordapp.com/invite/NtAbbGn) in the dedicated `#reedline` channel

## Good starting points

If you want to get started, check out the list of [issues](https://github.com/nushell/reedline/issues) with the ["good first issue" label](https://github.com/nushell/reedline/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22).

If you want to follow along with the history of how reedline got started, you can watch the [recordings](https://youtube.com/playlist?list=PLP2yfE2-FXdQw0I6O4YdIX_mzBeF5TDdv) of [JT](https://github.com/jntrnr)`s [live-coding streams](https://www.twitch.tv/jntrnr).

[Playlist: Creating a line editor in Rust](https://youtube.com/playlist?list=PLP2yfE2-FXdQw0I6O4YdIX_mzBeF5TDdv)

## Developing

### Set up

This is no different than other Rust projects.

```bash
git clone https://github.com/nushell/reedline
cd reedline
# To try our example program
cargo run --example basic
```

### Code style

We follow the standard rust formatting style and conventions suggested by [clippy](https://github.com/rust-lang/rust-clippy).

### To make the CI gods happy

Before submitting a PR make sure to run:

- for formatting

```shell
cargo fmt --all
```

- the clippy lints

```shell
cargo clippy
```

- the test suite

```shell
cargo test
```
Loading

0 comments on commit 9751132

Please sign in to comment.