Skip to content
This repository was archived by the owner on Nov 24, 2023. It is now read-only.

Commit 4b7e7cc

Browse files
committed
Update Readme to Include CLI Help
1 parent e74e9b0 commit 4b7e7cc

File tree

1 file changed

+41
-3
lines changed

1 file changed

+41
-3
lines changed

Readme.md

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
> **HIGHLY EXPERIMENTAL – MIGHT EAT YOUR CODE**
44
5-
The goal of this tool is to read and apply the suggestions made by rustc (and third-party lints, like those offered by [Clippy](https://github.com/Manishearth/rust-clippy)).
5+
The goal of this tool is to read and apply the suggestions made by rustc (and third-party lints, like those offered by [Clippy][clippy]).
6+
7+
[clippy]: https://github.com/Manishearth/rust-clippy
68

79
## Current state
810

@@ -14,6 +16,42 @@ This tool can
1416

1517
![rustfix demo](http://i.imgur.com/E9YkK76.png)
1618

19+
## Installation
20+
21+
Assuming you have a recent Rust nightly and Cargo installed:
22+
23+
```sh
24+
$ cargo install --git https://github.com/killercup/rustfix.git
25+
```
26+
27+
Make sure the binaries installed by Cargo are in your `$PATH`.
28+
29+
## Usage
30+
31+
In your project directory, just execute `rustfix`!
32+
33+
You probably want to use `rustfix --clippy` to get all the suggestions from [Clippy][clippy] as well. Make sure you have `cargo clippy` installed (`cargo install clippy`).
34+
35+
Please note that running `rustfix` multiple times in a project where no file was changed in the meantime will currently not generate any suggesions (as Cargo/Rust will skip the unchanged code and not compile it again).
36+
37+
### CLI Options
38+
39+
```plain
40+
rustfix 0.1.0
41+
Automatically apply suggestions made by rustc
42+
43+
USAGE:
44+
rustfix [FLAGS] [OPTIONS]
45+
46+
FLAGS:
47+
--clippy Use `cargo clippy` for suggestions
48+
-h, --help Prints help information
49+
-V, --version Prints version information
50+
51+
OPTIONS:
52+
--from-file <FILE> Read suggestions from file (each line is a JSON object)
53+
```
54+
1755
## Get the example running
1856

1957
My current example output for diagnostics is based on [libui-rs](https://github.com/pcwalton/libui-rs). You can find the example JSON in `tests/fixtures/libui-rs/clippy.json`.
@@ -22,10 +60,10 @@ Run `rustfix`:
2260

2361
```sh
2462
$ cd tests/fixtures/libui-rs/
25-
$ cargo run -- clippy.json
63+
$ cargo run -- --from-file clippy.json
2664
```
2765

28-
### Generate the diagnostics JSON file yourself
66+
### Generate the example diagnostics JSON yourself
2967

3068
```sh
3169
$ git clone https://github.com/pcwalton/libui-rs.git

0 commit comments

Comments
 (0)