Skip to content

Commit a57f57d

Browse files
committed
feat(cli): improve style of help message
1 parent c4e978c commit a57f57d

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

src/main.rs

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ fn cli() -> errors::Result<Opts> {
3737
let matches = App::new("csv2html")
3838
.version("3.0.0")
3939
.about("Convert CSV files to HTML tables")
40-
.arg(Arg::with_name("input").help("input file").index(1))
40+
.arg(Arg::with_name("input").help("Input file").index(1))
4141
.arg(
4242
Arg::with_name("output")
4343
.short("o")
4444
.long("output")
4545
.value_name("OUTPUT")
46-
.help("output file"),
46+
.help("Output file"),
4747
)
4848
.arg(
4949
Arg::with_name("title")
@@ -57,44 +57,44 @@ fn cli() -> errors::Result<Opts> {
5757
.short("d")
5858
.long("delimiter")
5959
.value_name("DELIM")
60-
.help("field delimiter character for CSV (',' by default)"),
60+
.help("Field delimiter character for CSV (',' by default)"),
6161
)
6262
.arg(
6363
Arg::with_name("start")
6464
.short("s")
6565
.long("start")
6666
.value_name("N")
67-
.help("skip the first N-1 rows, start at row N"),
67+
.help("Skip the first N-1 rows; start at row N"),
6868
)
6969
.arg(
7070
Arg::with_name("renumber")
7171
.short("r")
7272
.long("renumber")
73-
.help("replace the first column with row numbers"),
73+
.help("Replace the first column with row numbers"),
7474
)
7575
.arg(
7676
Arg::with_name("no-header")
7777
.short("n")
7878
.long("no-header")
79-
.help("do not use the first row of the input as the header"),
79+
.help("Do not use the first row of the input as the header"),
8080
)
8181
.arg(
8282
Arg::with_name("complete-document")
8383
.short("c")
8484
.long("complete-document")
8585
.help(
86-
"output a complete HTML document instead of only a table",
86+
"Output a complete HTML document instead of only a table",
8787
),
8888
)
8989
.arg(
9090
Arg::with_name("table")
9191
.long("table")
9292
.value_name("ATTRS")
9393
.help(
94-
"Attributes for the tag <table> (e.g., --table \
95-
'foo=\"bar\" baz' results in the output <table \
96-
foo=\"bar\" baz>...</table>); it is up to the \
97-
user to ensure the result is valid HTML",
94+
"HTML attributes for the tag <table> (e.g., --table \
95+
'foo=\"bar\" baz' results in the output <table \
96+
foo=\"bar\" baz>...</table>); it is up to the \
97+
user to ensure the result is valid HTML",
9898
),
9999
)
100100
.arg(
@@ -240,17 +240,23 @@ fn main() {
240240
match app() {
241241
Ok(_) => exit(exitcode::OK),
242242
Err(ref err) => match err {
243-
errors::Error::OpenInput { filename: _, source: _ }
244-
| errors::Error::OpenOutput { filename: _, source: _ }
243+
errors::Error::OpenInput {
244+
filename: _,
245+
source: _,
246+
}
247+
| errors::Error::OpenOutput {
248+
filename: _,
249+
source: _,
250+
}
245251
| errors::Error::WriteOutput { source: _ } => {
246252
eprintln!("{}", err);
247253
exit(exitcode::IOERR);
248-
},
254+
}
249255
errors::Error::ParseHeader { source: _ }
250256
| errors::Error::ParseRow { source: _ } => {
251257
eprintln!("{}", err);
252258
exit(exitcode::DATAERR);
253-
},
259+
}
254260
_ => {
255261
eprintln!("{}", err);
256262
exit(exitcode::SOFTWARE);

0 commit comments

Comments
 (0)