Reorder the --help message
This commit is contained in:
parent
6d0695303a
commit
a3c85cdc41
@ -1,2 +0,0 @@
|
||||
error_on_line_overflow = true
|
||||
error_on_unformatted = true
|
@ -90,40 +90,33 @@ enum HelpOp {
|
||||
fn make_opts() -> Options {
|
||||
let mut opts = Options::new();
|
||||
|
||||
// Sorted in alphabetical order.
|
||||
opts.optflag("", "backup", "Backup any modified files.");
|
||||
opts.optflag(
|
||||
"",
|
||||
"check",
|
||||
"Run in 'check' mode. Exits with 0 if input if formatted correctly. Exits \
|
||||
with 1 and prints a diff if formatting is required.",
|
||||
);
|
||||
let is_nightly = is_nightly();
|
||||
let emit_opts = if is_nightly {
|
||||
"[files|stdout|coverage|checkstyle]"
|
||||
} else {
|
||||
"[files|stdout]"
|
||||
};
|
||||
opts.optopt("", "emit", "What data to emit and how", emit_opts);
|
||||
opts.optflag("", "backup", "Backup any modified files.");
|
||||
opts.optopt(
|
||||
"",
|
||||
"config-path",
|
||||
"Recursively searches the given path for the rustfmt.toml config file. If not \
|
||||
found reverts to the input file path",
|
||||
"[Path for the configuration file]",
|
||||
);
|
||||
opts.optopt(
|
||||
"",
|
||||
"color",
|
||||
"Use colored output (if supported)",
|
||||
"[always|never|auto]",
|
||||
);
|
||||
opts.optopt(
|
||||
"",
|
||||
"config-path",
|
||||
"Recursively searches the given path for the rustfmt.toml config file. If not \
|
||||
found reverts to the input file path",
|
||||
"[Path for the configuration file]",
|
||||
);
|
||||
let is_nightly = is_nightly();
|
||||
let emit_opts = if is_nightly {
|
||||
"[files|stdout|coverage|checkstyle]"
|
||||
} else {
|
||||
"[files|stdout]"
|
||||
};
|
||||
opts.optopt("", "emit", "What data to emit and how", emit_opts);
|
||||
opts.optflagopt(
|
||||
"h",
|
||||
"help",
|
||||
"Show this message or help about a specific topic: `config` or `file-lines`",
|
||||
"=TOPIC",
|
||||
);
|
||||
opts.optopt(
|
||||
"",
|
||||
"print-config",
|
||||
@ -131,9 +124,6 @@ fn make_opts() -> Options {
|
||||
subset of the current config file used for formatting the current program.",
|
||||
"[minimal|default] PATH",
|
||||
);
|
||||
opts.optflag("v", "verbose", "Print verbose output");
|
||||
opts.optflag("q", "quiet", "Print less output");
|
||||
opts.optflag("V", "version", "Show version information");
|
||||
|
||||
if is_nightly {
|
||||
opts.optflag(
|
||||
@ -141,12 +131,6 @@ fn make_opts() -> Options {
|
||||
"unstable-features",
|
||||
"Enables unstable features. Only available on nightly channel.",
|
||||
);
|
||||
opts.optflag(
|
||||
"",
|
||||
"error-on-unformatted",
|
||||
"Error if unable to get comments or string literals within max_width, \
|
||||
or they are left with trailing whitespaces (unstable).",
|
||||
);
|
||||
opts.optopt(
|
||||
"",
|
||||
"file-lines",
|
||||
@ -154,6 +138,12 @@ fn make_opts() -> Options {
|
||||
more detail (unstable).",
|
||||
"JSON",
|
||||
);
|
||||
opts.optflag(
|
||||
"",
|
||||
"error-on-unformatted",
|
||||
"Error if unable to get comments or string literals within max_width, \
|
||||
or they are left with trailing whitespaces (unstable).",
|
||||
);
|
||||
opts.optflag(
|
||||
"",
|
||||
"skip-children",
|
||||
@ -161,6 +151,16 @@ fn make_opts() -> Options {
|
||||
);
|
||||
}
|
||||
|
||||
opts.optflag("v", "verbose", "Print verbose output");
|
||||
opts.optflag("q", "quiet", "Print less output");
|
||||
opts.optflag("V", "version", "Show version information");
|
||||
opts.optflagopt(
|
||||
"h",
|
||||
"help",
|
||||
"Show this message or help about a specific topic: `config` or `file-lines`",
|
||||
"=TOPIC",
|
||||
);
|
||||
|
||||
opts
|
||||
}
|
||||
|
||||
@ -177,7 +177,6 @@ fn execute(opts: &Options) -> FmtResult<(WriteMode, Summary)> {
|
||||
match determine_operation(&matches)? {
|
||||
Operation::Help(HelpOp::None) => {
|
||||
print_usage_to_stdout(opts, "");
|
||||
Summary::print_exit_codes();
|
||||
Ok((WriteMode::None, Summary::default()))
|
||||
}
|
||||
Operation::Help(HelpOp::Config) => {
|
||||
|
@ -360,7 +360,7 @@ impl CliOptions {
|
||||
options.unstable_features = matches.opt_present("unstable-features");
|
||||
}
|
||||
|
||||
if !options.unstable_features {
|
||||
if options.unstable_features {
|
||||
if matches.opt_present("skip-children") {
|
||||
options.skip_children = Some(true);
|
||||
}
|
||||
|
@ -102,13 +102,6 @@ impl Summary {
|
||||
self.has_parsing_errors |= other.has_parsing_errors;
|
||||
self.has_diff |= other.has_diff;
|
||||
}
|
||||
|
||||
pub fn print_exit_codes() {
|
||||
let exit_codes = r#"Exit Codes:
|
||||
0 = No errors
|
||||
1 = Encountered error in formatting code"#;
|
||||
println!("{}", exit_codes);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user