Skip to content

Commit 5654afd

Browse files
authored
docs: update readme (reubeno#976)
1 parent 97368bb commit 5654afd

4 files changed

Lines changed: 315 additions & 73 deletions

File tree

β€Ž.github/copilot-instructions.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
**brush** (Bourne Rusty Shell) is a POSIX- and bash-compatible shell implemented in Rust. It's a multi-crate workspace (~60K lines of Rust code) targeting Linux, macOS, and WSL, with experimental Windows and WASM support. The project emphasizes compatibility testing against bash as an oracle.
66

7-
**Key Stats:** Rust 2024 edition, MSRV 1.87.0, 5 main crates, 675+ compatibility test cases, published to crates.io.
7+
**Key Stats:** Rust 2024 edition, MSRV 1.87.0, 5 main crates, 1400+ compatibility test cases, published to crates.io.
88

99
## Critical: Read AGENTS.md First
1010

β€ŽREADME.mdβ€Ž

Lines changed: 94 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,17 @@
1010
<a href="https://crates.io/crates/brush-shell"><img src="https://img.shields.io/crates/v/brush-shell?style=flat-square"/></a>
1111
<!-- msrv badge -->
1212
<img src="https://img.shields.io/crates/msrv/brush-shell"/>
13-
<!-- LoC badge: badge generation seems broken; temporarily disabled -->
14-
<!-- <img src="https://tokei.rs/b1/github/reubeno/brush?category=code"/> -->
1513
<!-- license badge -->
1614
<img src="https://img.shields.io/badge/license-MIT-blue?style=flat-square"/>
17-
<!-- CI status badge -->
18-
<a href="https://github.com/reubeno/brush/actions/workflows/ci.yaml"><img src="https://github.com/reubeno/brush/actions/workflows/ci.yaml/badge.svg"/></a>
1915
<br/>
2016
<!-- crates.io download badge -->
2117
<a href="https://crates.io/crates/brush-shell"><img src="https://img.shields.io/crates/d/brush-shell?style=flat-square"/></a>
18+
<!-- compat tests badge -->
19+
<img src="https://img.shields.io/badge/compat_tests-1389-brightgreen?style=flat-square" alt="1389 compatibility tests"/>
2220
<!-- Packaging badges -->
2321
<a href="https://repology.org/project/brush/versions">
2422
<img src="https://repology.org/badge/tiny-repos/brush.svg" alt="Packaging status"/>
2523
</a>
26-
<!-- Dependencies badges -->
27-
<a href="https://deps.rs/repo/github/reubeno/brush"><img src="https://deps.rs/repo/github/reubeno/brush/status.svg" alt="Dependency status"/></a>
2824
<!-- Social badges -->
2925
<a href="https://discord.gg/kPRgC9j3Tj">
3026
<img src="https://dcbadge.limes.pink/api/server/https://discord.gg/kPRgC9j3Tj?compact=true&style=flat" alt="Discord invite"/>
@@ -38,58 +34,88 @@
3834

3935
<hr/>
4036

41-
`brush` (**B**o(u)rn(e) **RU**sty **SH**ell) is a [POSIX-](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html) and [bash-](https://www.gnu.org/software/bash/)compatible shell,
42-
implemented in Rust. At its core is an embeddable shell interpreter published for reuse
43-
in other Rust projects. It's built and tested on Linux, macOS, and WSL. Native Windows
44-
support is experimental.
37+
`brush` (**B**o(u)rn(e) **RU**sty **SH**ell) is a modern [bash-](https://www.gnu.org/software/bash/) and [POSIX-](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html) compatible shell written in Rust. Run your existing scripts and `.bashrc` unchanged -- with syntax highlighting and auto-suggestions built in.
38+
39+
## At a glance
40+
41+
βœ… Your existing `.bashrc` just worksβ€”aliases, functions, completions, all of it.<br/>
42+
✨ Syntax highlighting and auto-suggestions built in and enabled by default.<br/>
43+
πŸ§ͺ Validated against bash with [~1400 compatibility tests](brush-shell/tests/cases).<br/>
44+
🧩 Easily embeddable in your Rust apps using `brush_core::Shell`.<br/>
4545

4646
<p align="center">
4747
<img src="https://github.com/user-attachments/assets/0e64d1b9-7e4e-43be-8593-6c1b9607ac52" width="80%"/>
4848
</p>
4949

50-
`brush` is functional for interactive use as a daily driver! It executes most `sh` and `bash` scripts we've
51-
encountered. Known limitations are tracked with filed issues. Out of an abundance of caution,
52-
we wouldn't recommend using it yet in _production_ scenarios in case it doesn't behave identically
53-
to your existing stable shell. (If you do find any behavioral differences, though, please report them with an
54-
issue!)
50+
> ⚠️ **Not everything works yet:** `coproc`, `select`, ERR traps, and some edge cases aren't supported. See the [Compatibility Reference](docs/reference/compatibility.md) for details.
5551
56-
Contributions and feedback of all kinds are welcome! For more guidance, please consult our
57-
[contribution guidelines](CONTRIBUTING.md). For more technical details, please consult the
58-
[documentation](docs/README.md) in this repo.
52+
### Quick start:
5953

60-
This project was originally borne out of curiosity and a desire to learn. We're doing our best to keep that
61-
attitude :).
54+
```console
55+
$ cargo binstall brush-shell # using cargo-binstall
56+
$ brew install brush # using Homebrew
57+
$ pacman -S brush # Arch Linux
58+
$ cargo install --locked brush-shell # Build from sources
59+
```
6260

63-
<br/>
61+
`brush` is ready for use as a daily driver. We test every change against `bash` to keep it that way.
62+
63+
More detailed installation instructions are available below.
64+
65+
## ✨ Features
66+
67+
### 🐚 `bash` Compatibility
6468

65-
## πŸ“ License
69+
| | Feature | Description |
70+
|--|---------|-------------|
71+
| βœ… | **50+ builtins** | `echo`, `declare`, `read`, `complete`, `trap`, `ulimit`, ... |
72+
| βœ… | **Full expansions** | brace, parameter, arithmetic, command/process substitution, globs, `extglob`, `globstar` |
73+
| βœ… | **Control flow** | `if`/`for`/`while`/`until`/`case`, `&&`/`||`, subshells, pipelines, etc. |
74+
| βœ… | **Redirection** | here docs, here strings, fd duplication, process substitution redirects |
75+
| βœ… | **Arrays & variables** | indexed/associative arrays, dynamic variables, standard well-known variables, etc. |
76+
| βœ… | **Programmable completion** | Works with [bash-completion](https://github.com/scop/bash-completion) out of the box |
77+
| βœ… | **Job control** | background jobs, suspend/resume, `fg`/`bg`/`jobs` |
78+
| πŸ”· | **Traps & options** | `EXIT`/`DEBUG` traps work; signal traps and options in progress |
6679

67-
Available for use and distribution under the [MIT license](LICENSE).
80+
### ⌨️ User Experience
6881

69-
## ⌨️ Installation
82+
| | Feature | Description |
83+
|--|---------|-------------|
84+
| βœ… | **Syntax highlighting** | Real-time as you type ([reedline](https://github.com/nushell/reedline)) |
85+
| βœ… | **Auto-suggestions** | History-based hints as you type ([reedline](https://github.com/nushell/reedline)) |
86+
| βœ… | **Rich prompts** | `PS1`/`PROMPT_COMMAND`, right prompts, [starship](https://starship.rs) compatible |
87+
| βœ… | **TOML config** | `~/.config/brush/config.toml` for persistent settings |
88+
| πŸ§ͺ | **Extras** | `fzf`/`atuin` support, zsh-style `precmd`/`preexec` hooks (experimental), VS Code terminal integration |
89+
90+
## Installation
7091

7192
_When you run `brush`, it should look exactly as `bash` does on your system: it processes your `.bashrc` and
7293
other standard configuration. If you'd like to distinguish the look of `brush` from the other shells
7394
on your system, you may author a `~/.brushrc` file._
7495

75-
<details open>
76-
<summary>πŸš€ <b>Installing prebuilt binaries from GitHub</b></summary>
96+
<details>
97+
<summary>🍺 <b>Installing using Homebrew</b> (macOS/Linux)</summary>
7798

78-
We publish prebuilt binaries of `brush` for Linux (x86_64, aarch64) and macOS (aarch64) to GitHub for official [releases](https://github.com/reubeno/brush/releases). You can manually download and extract the `brush` binary from one of the archives published there, or otherwise use the GitHub CLI to download it, e.g.:
99+
Homebrew users can install using [the `brush` formula](https://formulae.brew.sh/formula/brush):
79100

80101
```bash
81-
gh release download --repo reubeno/brush --pattern "brush-x86_64-unknown-linux-gnu.*"
102+
brew install brush
82103
```
83104

84-
After downloading the archive for your platform, you may verify its authenticity using the [GitHub CLI](https://cli.github.com/), e.g.:
105+
</details>
106+
107+
<details>
108+
<summary>🐧 <b>Installing on Arch Linux</b></summary>
109+
110+
Arch Linux users can install `brush` from the official [extra repository](https://archlinux.org/packages/extra/x86_64/brush/):
85111

86112
```bash
87-
gh attestation verify brush-x86_64-unknown-linux-gnu.tar.gz --repo reubeno/brush
113+
pacman -S brush
88114
```
89115

90116
</details>
91117

92-
<details open>
118+
<details>
93119
<summary>πŸš€ <b>Installing prebuilt binaries via `cargo binstall`</b></summary>
94120

95121
You may use [cargo binstall](https://github.com/cargo-bins/cargo-binstall) to install pre-built `brush` binaries. Once you've installed `cargo-binstall` you can run:
@@ -101,82 +127,78 @@ cargo binstall brush-shell
101127
</details>
102128

103129
<details>
104-
<summary> πŸ”¨ <b>Installing from sources</b></summary>
130+
<summary>πŸš€ <b>Installing prebuilt binaries from GitHub</b></summary>
105131

106-
To build from sources, first install a working (and recent) `rust` toolchain; we recommend installing it via [`rustup`](https://rustup.rs/). Then run:
132+
We publish prebuilt binaries of `brush` for Linux (x86_64, aarch64) and macOS (aarch64) to GitHub for official [releases](https://github.com/reubeno/brush/releases). You can manually download and extract the `brush` binary from one of the archives published there, or otherwise use the GitHub CLI to download it, e.g.:
107133

108134
```bash
109-
cargo install --locked brush-shell
135+
gh release download --repo reubeno/brush --pattern "brush-x86_64-unknown-linux-gnu.*"
110136
```
111137

112-
</details>
113-
114-
<details>
115-
<summary>🐧 <b>Installing using Nix</b></summary>
116-
117-
If you are a Nix user, you can use the registered version:
138+
After downloading the archive for your platform, you may verify its authenticity using the [GitHub CLI](https://cli.github.com/), e.g.:
118139

119140
```bash
120-
nix run 'github:NixOS/nixpkgs/nixpkgs-unstable#brush' -- --version
141+
gh attestation verify brush-x86_64-unknown-linux-gnu.tar.gz --repo reubeno/brush
121142
```
122143

123144
</details>
124145

125146
<details>
126-
<summary>🐧 <b>Installing on Arch Linux</b></summary>
147+
<summary>🐧 <b>Installing using Nix</b></summary>
127148

128-
Arch Linux users can install `brush` from the official [extra repository](https://archlinux.org/packages/extra/x86_64/brush/):
149+
If you are a Nix user, you can use the registered version:
129150

130151
```bash
131-
pacman -S brush
152+
nix run 'github:NixOS/nixpkgs/nixpkgs-unstable#brush' -- --version
132153
```
133154

134155
</details>
135156

136157
<details>
137-
<summary>🍺 <b>Installing using Homebrew</b></summary>
158+
<summary> πŸ”¨ <b>Building from sources</b></summary>
138159

139-
Homebrew users can install using [the `brush` formula](https://formulae.brew.sh/formula/brush):
160+
To build from sources, first install a working (and recent) `rust` toolchain; we recommend installing it via [`rustup`](https://rustup.rs/). Then run:
140161

141162
```bash
142-
brew install brush
163+
cargo install --locked brush-shell
143164
```
144165

145166
</details>
146167

147-
## πŸ‘₯ Community
148-
149-
`brush` has a community Discord server, available [here](https://discord.gg/kPRgC9j3Tj).
168+
## Community & Contributing
150169

151-
## πŸ§ͺ Testing strategy
170+
This project started out of curiosity and a desire to learnβ€”we're keeping that attitude. If something doesn't work the way you'd expect, [let us know](https://github.com/reubeno/brush/issues)!
152171

153-
This project is primarily tested by comparing its behavior with other existing shells, leveraging the latter as test oracles. The integration tests implemented in this repo include [900+ test cases](brush-shell/tests/cases) run on both this shell and an oracle, comparing standard output and exit codes.
172+
* [Discord server](https://discord.gg/kPRgC9j3Tj) β€” chat with the community
173+
* [Building from source](docs/how-to/build.md) β€” development workflow
174+
* [Contribution guidelines](CONTRIBUTING.md) β€” how to submit changes
175+
* [Technical docs](docs/README.md) β€” architecture and reference
154176

155-
For more details, please consult the [reference documentation on integration testing](docs/reference/integration-testing.md).
177+
## Related Projects
156178

157-
## πŸ™ Credits
179+
Other POSIX-ish shells implemented in non-C/C++ languages:
158180

159-
There's a long list of OSS crates whose shoulders this project rests on. Notably, the following crates are directly relied on for major portions of shell functionality:
181+
* [`nushell`](https://www.nushell.sh/) β€” modern Rust shell (provides `reedline`)
182+
* [`fish`](https://fishshell.com) β€” user-friendly shell ([Rust port in 4.0](https://fishshell.com/blog/rustport/))
183+
* [`Oils`](https://github.com/oils-for-unix/oils) β€” bash-compatible with new Oil language
184+
* [`mvdan/sh`](https://github.com/mvdan/sh) β€” Go implementation
185+
* [`rusty_bash`](https://github.com/shellgei/rusty_bash) β€” another Rust bash-like shell
160186

161-
* [`reedline`](https://github.com/nushell/reedline) - for readline-like input and interactive usage
162-
* [`clap`](https://github.com/clap-rs/clap) - command-line parsing, used both by the top-level brush CLI as well as built-in commands
163-
* [`fancy-regex`](https://github.com/fancy-regex/fancy-regex) - relied on for everything regex
164-
* [`tokio`](https://github.com/tokio-rs/tokio) - async, well, everything
165-
* [`nix` rust crate](https://github.com/nix-rust/nix) - higher-level APIs for Unix/POSIX system APIs
166-
167-
For testing, performance benchmarking, and other important engineering support, we use and love:
187+
<details>
188+
<summary><b>πŸ™ Credits</b></summary>
168189

169-
* [`criterion.rs`](https://github.com/bheisler/criterion.rs) - for statistics-based benchmarking
170-
* [`bash-completion`](https://github.com/scop/bash-completion) - for its completion test suite and general completion support!
190+
This project relies on many excellent OSS crates:
171191

172-
## πŸ”— Links: other shell implementations
192+
* [`reedline`](https://github.com/nushell/reedline) β€” readline-like input and interactive features
193+
* [`clap`](https://github.com/clap-rs/clap) β€” command-line parsing
194+
* [`fancy-regex`](https://github.com/fancy-regex/fancy-regex) β€” regex support
195+
* [`tokio`](https://github.com/tokio-rs/tokio) β€” async runtime
196+
* [`nix`](https://github.com/nix-rust/nix) β€” Unix/POSIX APIs
197+
* [`criterion.rs`](https://github.com/bheisler/criterion.rs) β€” benchmarking
198+
* [`bash-completion`](https://github.com/scop/bash-completion) β€” completion test suite
173199

174-
There are a number of other POSIX-ish shells implemented in a non-C/C++ implementation language. Some inspirational examples include:
200+
</details>
175201

176-
* [`nushell`](https://www.nushell.sh/) - modern Rust-implemented shell (which also provides the `reedline` crate we use!)
177-
* [`rusty_bash`](https://github.com/shellgei/rusty_bash)
178-
* [`mvdan/sh`](https://github.com/mvdan/sh)
179-
* [`Oils`](https://github.com/oils-for-unix/oils)
180-
* [`fish`](https://fishshell.com) ([as of 4.0](https://fishshell.com/blog/rustport/))
202+
---
181203

182-
We're sure there are plenty more; we're happy to include links to them as well.
204+
Licensed under the [MIT license](LICENSE).

β€Ždocs/reference/README.mdβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ These documents serve as reference material for the `brush` project.
55
* [Configuration file](configuration.md)
66
* [Integration testing](integration-testing.md)
77
* [Minimum Supported Rust Version (MSRV) policy](msrv-policy.md)
8+
* [Compatibility](compatibility.md)

0 commit comments

Comments
Β (0)