Commit Graph

246 Commits

Author SHA1 Message Date
Jan Likar
c578ad8df5 Remove --write-mode=replace from cargo-fmt
Since replace is the default rustfmt write mode, there's no need to
call rustfmt with `--write-mode=replace`. As a bonus, it is now also
possible to override the write-mode.
2015-12-17 17:17:43 +01:00
Sean Marshallsay
7f21569351 Fix spelling mistake in cargo-fmt usage string. 2015-12-16 12:18:18 +00:00
Nick Cameron
ecf12778fb Use replace rather than overwrite for cargo fmt 2015-12-16 18:07:59 +13:00
Jan Likar
1e5e290e39 Allow to pass arguments to rustfmt 2015-12-16 04:48:49 +01:00
Jan Likar
360f3efce8 Replace locate-project with read-manifest
Use `cargo read-manifest` instead of `cargo locate-project` to get
a list of files to be formatted.
2015-12-16 02:21:43 +01:00
Jan Likar
623277e7e0 Add cargo-fmt binary
Add a new utility, which formats all readable .rs files in the src
directory of the crate using rustfmt. Both binaries can be installed
using cargo install rustfmt. cargo-fmt can be used as a Cargo
subcommand - cargo fmt.
2015-12-14 15:50:19 +01:00
Nick Cameron
26297c56df Merge pull request #615 from JanLikar/version
Add --version switch
2015-12-07 07:32:16 +13:00
Manish Goregaokar
f61ba91c2d Minor clippy fixes 2015-12-04 18:02:19 +05:30
Marcus Klaas
6e1f77664d Unwrap match arms that are simple blocks 2015-11-20 21:05:18 +01:00
Steven Fackler
d7b331bea7 Use argv[0] for usage output
Usage messages traditionally use this as it contains the path that the
user provided to run the executable (e.g. `rustfmt` instead of
`/usr/local/bin/rustfmt`).
2015-11-19 17:56:37 -08:00
Jan Likar
f85ff8d0e5 Print version of the crate
Print version acquired from Cargo when building. If built using rustc
directly, print X.X.X
2015-11-18 00:56:46 +01:00
Jan Likar
1eb38c461e Add -V as a shorthand for --version 2015-11-16 14:52:14 +01:00
Jan Likar
6e063a1430 Add --version switch
Add --version switch, which prints a short hash of the current
commit. Fix #612
2015-11-16 04:37:08 +01:00
Seo Sanghyeon
faff4bc9e8 Add verbose mode 2015-11-15 15:41:41 +09:00
Jan Likar
4443c4b7cc Correct some non-idiomatic code 2015-11-13 02:08:57 +01:00
Jan Likar
cb64ab22ec Enable rustfmt to format a list of files
Fix #580 by allowing rustfmt to accept a list of files. This also
enables usage of shell wildcard expansion, although notably this does
not work with cmd.exe on Windows. For example: 'rustfmt *.rs' will
format all rust files in the current working directory.

  - Change usage text to show rustfmt will accept a list of files
  - Change "Using rustfmt config file: {}" message to
    "Using rustfmt config file {} for {}"
  - Change Operation::Format(PathBuf, WriteMode) to
    Operation::Format(Vec<PathBuf>, WriteMode)
  - Loop through Vec<PathBuf>, load config and call 'run' for each path
2015-11-13 01:32:22 +01:00
Jørn Lode
5d07b63ce5 Check if the CWD contains a config (previously it only checked parents) 2015-11-09 21:41:25 +01:00
Kamal Marhubi
ae13bbcc98 Move config help to dedicated --config-help flag
The existing help output is very verbose, overflowing a 50+ line
terminal. This moves the configuration options to a separate help flag
to make a mistyped command less annoying!
2015-11-07 19:03:25 -05:00
Mitsutaka Mimura
67f0b00112 fix unused variable path warning 2015-11-05 08:14:55 +09:00
Johann
154e20a04f Address review concerns 2015-11-03 09:16:33 +01:00
Johann
fcc62cbbe0 Stdin support
Adds support for receiving input from stdin in case no file was
specified. This is useful for editor/IDE integrations and other tooling.

To achieve clean output a new write-mode option called plain was added,
this option is mandatory when using stdin.
2015-11-02 20:45:45 +01:00
Marcus Klaas
4fa0b0bc57 Print configuration options once in help message 2015-10-24 16:03:10 +02:00
Ravi Shankar
d135217db2 show rustfmt coverage! 2015-10-24 15:22:37 +05:30
defuz
2ec769709f Lookup rustfmt.toml file is relative from input file, not from current directory 2015-10-24 02:14:12 +03:00
Alex Crichton
26958a1c10 Move option parsing to crates.io-based getopts crate
Should help adding more options in the future as well!
2015-10-23 13:46:14 -07:00
Alex Crichton
36abfe5dc2 Remove usage of many unstable features
This removes usage of:

* PathExt
* split_last
* split_last_mut
* catch_panic

The catch_panic one was a little tricky as the ident interner needed to be
cloned across threads (a little unsafely), but it should otherwise be good to
go.
2015-10-23 13:46:14 -07:00
Alex Crichton
cda463275e Use the log/env_logger crates from crates.io 2015-10-23 13:46:14 -07:00
Scyptnex
00b314618d Refactoring configuration 2015-09-29 09:38:19 +10:00
Marcus Klaas
e72d488281 Refactor test code
No longer use callbacks or thread::catch_panic; reduce stdout spew; guard against rustfmt breaking the column limit.
2015-09-18 22:34:46 +02:00
Aaron Lobb
d773580715 Changed ConfigType trait to only return a string of variants, rather than a vec 2015-09-14 13:43:55 -07:00
Aaron Lobb
cd9e9b5db0 Merged config imports 2015-09-14 13:06:09 -07:00
Aaron Lobb
8b808de6ff Fixed https://github.com/nrc/rustfmt/issues/291; added output to --help runtime option with possible config values 2015-09-14 00:29:15 -07:00
Marcus Klaas
749a9689be Break chains that don't start with path expressions 2015-09-11 00:52:57 +02:00
Sinh Pham
e7a5f9327e Add diff write mode https://github.com/nrc/rustfmt/issues/261 2015-09-10 18:30:07 -04:00
Christoph Burgdorf
56183ce0e9 fix outdated help text 2015-09-04 21:28:37 +02:00
Mika Attila
1f974fca01 Simplify match expression 2015-08-28 23:51:26 +02:00
Mika Attila
ce25165450 Don't pass --write-mode argument to rustc
Fixes regression introduced by
660f41865b
2015-08-28 13:12:27 +02:00
Mika Attila
660f41865b Only exit after running all destructors and flushing stdout 2015-08-28 10:39:58 +02:00
Alex HotShot Newman
39538a0c77 Fix usage of the tool. Provide -h and --help 2015-08-26 15:07:01 -07:00
Simon Bernier St-Pierre
9ead47151e Add project-specific configuration file support 2015-08-25 19:05:30 -04:00
Marcus Klaas
10a80bb8be Add an option to forgo backups 2015-08-19 21:31:27 +02:00
Alex Newman
2f4ef7dd1e Provide information about default.toml 2015-08-18 11:35:18 -07:00
Marcus Klaas
5924b83829 Rustup 2015-06-22 14:52:23 +02:00
Nick Cameron
1a09a6d00a Use config file for constants 2015-05-23 17:53:53 +12:00
Marcus Klaas
4aa3518703 Format required methods on traits 2015-05-12 02:37:05 +02:00
Oliver Schneider
62e583d4cf split main function and test function into their own files
small modifications to make executable and test compile properly
2015-05-01 22:28:58 +02:00