Skip to content

Commit 69d821c

Browse files
committed
Make --threads global, spanning subcommands
1 parent 36d9a23 commit 69d821c

1 file changed

Lines changed: 10 additions & 18 deletions

File tree

src/main.rs

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ fn define_cli<'a>() -> ArgMatches<'a> {
4949
.multiple(true)
5050
.help("Sets the level of verbosity"),
5151
)
52+
.arg(
53+
Arg::with_name("num_threads")
54+
.global(true)
55+
.required(true)
56+
.long("threads")
57+
.help(&format!("Maximum number of threads. If 0 or unspecified, {} will select the number of threads automatically.", CRATE_NAME))
58+
.takes_value(true)
59+
.default_value("0")
60+
.value_name("INT")
61+
)
5262
.subcommand(
5363
SubCommand::with_name("index")
5464
.about("Indexes a genome file")
@@ -233,15 +243,6 @@ fn define_cli<'a>() -> ArgMatches<'a> {
233243
.default_value("3130")
234244
.value_name("INT")
235245
)
236-
.arg(
237-
Arg::with_name("num_threads")
238-
.required(true)
239-
.long("threads")
240-
.help(&format!("Maximum number of threads. If 0 or unspecified, {} will select the number of threads automatically.", CRATE_NAME))
241-
.takes_value(true)
242-
.default_value("0")
243-
.value_name("INT")
244-
)
245246
.arg(
246247
Arg::with_name("gap_dist_ends")
247248
.required(true)
@@ -280,15 +281,6 @@ fn define_cli<'a>() -> ArgMatches<'a> {
280281
.default_value("3130")
281282
.value_name("INT")
282283
)
283-
.arg(
284-
Arg::with_name("num_threads")
285-
.required(true)
286-
.long("threads")
287-
.help(&format!("Maximum number of threads. If 0 or unspecified, {} will select the number of threads automatically.", CRATE_NAME))
288-
.takes_value(true)
289-
.default_value("0")
290-
.value_name("INT")
291-
),
292284
)
293285
.get_matches()
294286
}

0 commit comments

Comments
 (0)