]> git.lizzy.rs Git - rust.git/blobdiff - README.md
Merge pull request #189 from nrc/match
[rust.git] / README.md
index 2bddeb869da655d48fd4f5e17c77bc8af0b29ede..61e01dcb9fde267598da8b47a0db3bd11260a4b5 100644 (file)
--- a/README.md
+++ b/README.md
@@ -5,18 +5,26 @@ A tool for formatting Rust code according to style guidelines.
 
 ## How to use
 
-You'll need a pretty up to date version of the **nightly** version of Rust.
+You'll need a pretty up to date version of the **nightly** version of Rust. 
+You will need a default.toml file in the current working directory when you run
+the rustfmt command. You can look at this repo for an example default.toml file.
 
 `cargo build` to build.
 
 `cargo test` to run all tests.
 
-`cargo run filename` to run on a file, if the file includes out of line modules,
+`cargo run -- filename` to run on a file, if the file includes out of line modules,
 then we reformat those too. So to run on a whole module or crate, you just need
-to run on the top file. You'll probably want to set the `WriteMode` in the call
-to `run` in `main()`. Eventually you should be able to set the mode from the
-command line or from a config file or something.
+to run on the top file. 
 
+You'll probably want to specify the write mode. Currently, there are the replace,
+overwrite and display mode. The replace mode is the default and overwrites the
+original files after renaming them. In overwrite mode, rustfmt does not backup
+the source files. To print the output to stdout, use the display mode. The write
+mode can be set by passing the `--write-mode` flag on the command line.
+
+`cargo run -- filename --write-mode=display` prints the output of rustfmt to the
+screen, for example.
 
 ## Use cases
 
@@ -201,8 +209,7 @@ It would be really useful to have people use rustfmt on their projects and file
 issues where it does something you don't expect.
 
 A really useful thing to do that on a crate from the Rust repo. If it does
-something unexpected, file an issue; if not, make a PR to the Rust repo with the
-reformatted code. I hope to get the whole repo consistently rustfmt'ed and to
+something unexpected, file an issue; if not, make a PR to the Rust repo with the reformatted code. I hope to get the whole repo consistently rustfmt'ed and to
 replace `make tidy` with rustfmt as a medium-term goal.
 
 ### Create test cases