-
Notifications
You must be signed in to change notification settings - Fork 924
config: Use write_mode from config #812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
6e68d23
to
2159c8b
Compare
@@ -112,6 +113,14 @@ fn match_cli_path_or_file(config_path: Option<PathBuf>, | |||
fn update_config(config: &mut Config, matches: &Matches) { | |||
config.verbose = matches.opt_present("verbose"); | |||
config.skip_children = matches.opt_present("skip-children"); | |||
|
|||
let write_mode = matches.opt_str("write-mode").map(|ref s| { | |||
WriteMode::from_str(s).expect(&format!("Invalid write-mode: {}", s)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't panic due to invalid user input. We should exit gracefully with the message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
LGTM, just that one comment to address |
I prefer the version you've currently implemented, thanks! However, you now have a test error. Could you also squash the commits before I merge? |
This commit tidies up handling of `write_mode` by setting it in the config at the start, and removing the `write_mode` parameter threaded throughout the formatting process.
732e18b
to
14dbac5
Compare
The formating tool that tests its own formatting... keeps biting! :-)
Should be all done! |
Awesome, thanks! |
This commit tidies up handling of
write_mode
by setting it in theconfig at the start, and removing the
write_mode
parameter threadedthroughout the formatting process.