Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thlorenz/solfmt
Formats output of Solana's cargo test-bpf/test-sbf command
https://github.com/thlorenz/solfmt
Last synced: 2 months ago
JSON representation
Formats output of Solana's cargo test-bpf/test-sbf command
- Host: GitHub
- URL: https://github.com/thlorenz/solfmt
- Owner: thlorenz
- Created: 2022-12-13T04:29:17.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-03-15T23:06:58.000Z (10 months ago)
- Last Synced: 2024-10-18T01:28:21.654Z (3 months ago)
- Language: Rust
- Size: 2.39 MB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# solfmt
Formats output of Solana's `cargo test-bpf/test-sbf` command.
![fmt-logs](assets/fmt-logs.png)
## Installation
```sh
cargo install solfmt
```## Usage
1. Run the your test command as usual (`cargo test-sbf -- --test-threads=1`)
2. Pipe `stderr` into `stdout` (`2>&1`)
3. Pipe the result to `solfmt` (`| sofmt`)```sh
cargo test-sbf -- --test-threads=1 2>&1 | solfmt
```4. Enjoy more readable logs
## Preserving Colorful Build Output
Since we're piping the output of `cargo test-sbf` into _solfmt_ it doesn't print in colors by
default.We can fix that by setting the `CARGO_TERM_COLOR` env var appropriately.
```sh
CARGO_TERM_COLOR=always cargo test-sbf -- --nocapture --test-threads=1 2>&1 | solfmt
```Since this is a lot to type you should add a reusable function to your bashrc.
The below [defined in my
dotfiles](https://github.com/thlorenz/dotfiles/blob/ab362381b8e9b9d7ee7e0b71ae590cc14b88f879/bash/rust-aliases.sh#L29-L32)
allows to focus on a simple test as well by providing it as an argument.```sh
function cg-tsbf() {
clear;
CARGO_TERM_COLOR=always cargo test-sbf $1 -- --nocapture --test-threads=1 2>&1 | solfmt
}
```## LICENSE
MIT