Skip to content

Commit b512041

Browse files
committed
Format strings with rustfmt
rust-lang/rustfmt#3863 (comment)
1 parent 64f1304 commit b512041

File tree

3 files changed

+110
-35
lines changed

3 files changed

+110
-35
lines changed

.github/workflows/rust.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v2
10+
- uses: actions-rs/toolchain@v1
11+
with:
12+
profile: minimal
13+
toolchain: nightly
14+
override: true
15+
components: rustfmt
1016
- run: cargo fmt -- --check
1117
build:
1218
runs-on: ubuntu-latest

rustfmt.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
unstable_features = true
2+
format_strings = true

src/main.rs

Lines changed: 102 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,24 @@ const PORT_RANGES: [(u16, u16); 4] = [(53, 53), (4000, 33433), (33565, 51820), (
178178

179179
fn app() -> clap::App<'static, 'static> {
180180
let name_arg = Arg::with_name("name")
181-
.help("Name linked with a public key. Defaults to the hostname of the system. This value has no effect on the functioning of the VPN.")
181+
.help(
182+
"Name linked with a public key. Defaults to the hostname of the system. This value \
183+
has no effect on the functioning of the VPN.",
184+
)
182185
.long("name");
183186
clap::app_from_crate!()
184-
.after_help("To query MozillaVPN, mozwire requires a token, specified with --token. If it \
185-
is left unspecified, mozwire will generate a token by opening a login page, the token \
186-
generated can be printed using --print-token, so that it can be reused. To generate a \
187-
WireGuard configuration use `mozwire relay save`.")
187+
.after_help(
188+
"To query MozillaVPN, mozwire requires a token, specified with --token. If it is left \
189+
unspecified, mozwire will generate a token by opening a login page, the token \
190+
generated can be printed using --print-token, so that it can be reused. To generate \
191+
a WireGuard configuration use `mozwire relay save`.",
192+
)
188193
.subcommand(
189194
SubCommand::with_name("device")
190-
.about("Add, remove and list devices. To connect to MozillaVPN, a device needs to be on the list.")
195+
.about(
196+
"Add, remove and list devices. To connect to MozillaVPN, a device needs to be \
197+
on the list.",
198+
)
191199
.subcommand(
192200
SubCommand::with_name("add")
193201
.about("List Devices")
@@ -198,7 +206,12 @@ fn app() -> clap::App<'static, 'static> {
198206
.conflicts_with("privkey")
199207
.required(true),
200208
)
201-
.arg(Arg::with_name("privkey").long("privkey").takes_value(true).required_unless("pubkey"))
209+
.arg(
210+
Arg::with_name("privkey")
211+
.long("privkey")
212+
.takes_value(true)
213+
.required_unless("pubkey"),
214+
)
202215
.arg(&name_arg),
203216
)
204217
.subcommand(
@@ -210,68 +223,122 @@ fn app() -> clap::App<'static, 'static> {
210223
SubCommand::with_name("remove")
211224
.alias("rm")
212225
.about("Remove a device")
213-
.arg(Arg::with_name("ids").help("Public, private key or name of the device to remove.").required(true).takes_value(true).multiple(true))
226+
.arg(
227+
Arg::with_name("ids")
228+
.help("Public, private key or name of the device to remove.")
229+
.required(true)
230+
.takes_value(true)
231+
.multiple(true),
232+
),
214233
)
215234
.setting(AppSettings::SubcommandRequiredElseHelp),
216235
)
217236
.subcommand(
218237
SubCommand::with_name("relay")
219-
.about("List available relays (VPN Servers) and save WireGuard configurations for these.")
238+
.about(
239+
"List available relays (VPN Servers) and save WireGuard configurations for \
240+
these.",
241+
)
220242
.subcommand(
221243
SubCommand::with_name("list")
222244
.alias("ls")
223245
.about("List relays"),
224246
)
225247
.subcommand(
226248
SubCommand::with_name("save")
227-
.about("Save wireguard configuration for a MozillaVPN server. If the \
228-
private key used is not in the device list uploaded, mozwire will upload \
229-
it.")
249+
.about(
250+
"Save wireguard configuration for a MozillaVPN server. If the private \
251+
key used is not in the device list uploaded, mozwire will upload it.",
252+
)
230253
.arg(
231254
Arg::with_name("regex")
232255
.help("Regex to filter servers by hostname.")
233256
.default_value(""),
234257
)
235-
.arg(Arg::with_name("output").short("o").help(
236-
"Directory in which to output the WireGuard configuration. Defaults to \
237-
the current directory",
238-
).default_value("."))
239258
.arg(
240-
Arg::with_name("privkey").long("privkey")
241-
.help("Private key to use in the configuration file. If it is not \
242-
specified, mozwire will generate one and update the device list.").takes_value(true),
243-
).arg(&name_arg).arg(
244-
Arg::with_name("port").long("port").short("p").default_value("51820")
245-
.help("Port to use. This can be changed to bypass firewalls and dissimulate \
246-
the use of WireGuard. A value of \"random\" will choose a random port \
247-
within the available range, which is the only available behaviour of the \
248-
windows MozillaVPN client."))
259+
Arg::with_name("output")
260+
.short("o")
261+
.help(
262+
"Directory in which to output the WireGuard configuration. \
263+
Defaults to the current directory",
264+
)
265+
.default_value("."),
266+
)
267+
.arg(
268+
Arg::with_name("privkey")
269+
.long("privkey")
270+
.help(
271+
"Private key to use in the configuration file. If it is not \
272+
specified, mozwire will generate one and update the device \
273+
list.",
274+
)
275+
.takes_value(true),
276+
)
277+
.arg(&name_arg)
278+
.arg(
279+
Arg::with_name("port")
280+
.long("port")
281+
.short("p")
282+
.default_value("51820")
283+
.help(
284+
"Port to use. This can be changed to bypass firewalls and \
285+
dissimulate the use of WireGuard. A value of \"random\" will \
286+
choose a random port within the available range, which is \
287+
the only available behaviour of the windows MozillaVPN \
288+
client.",
289+
),
290+
)
249291
.arg(
250292
Arg::with_name("limit")
251-
.help("Limit the number of servers saved. A value of 0 disables the limit.")
293+
.help(
294+
"Limit the number of servers saved. A value of 0 disables the \
295+
limit.",
296+
)
252297
.short("n")
253298
.default_value("1"),
254-
).arg(Arg::with_name("hop").help("Intermediate server (entry node) to connect to for multihop with wireguard.").takes_value(true).conflicts_with("port").long("hop"))
299+
)
300+
.arg(
301+
Arg::with_name("hop")
302+
.help(
303+
"Intermediate server (entry node) to connect to for multihop \
304+
with wireguard.",
305+
)
306+
.takes_value(true)
307+
.conflicts_with("port")
308+
.long("hop"),
309+
),
255310
)
256311
.setting(AppSettings::SubcommandRequiredElseHelp),
257312
)
258313
.arg(
259314
Arg::with_name("print-token")
260315
.long("print-token")
261-
.help("Print the token used to query the Mozilla API, so that it can be reused with --token, without having to sign in each time.")
262-
.global(true)
316+
.help(
317+
"Print the token used to query the Mozilla API, so that it can be reused with \
318+
--token, without having to sign in each time.",
319+
)
320+
.global(true),
263321
)
264322
.arg(
265323
Arg::with_name("token")
266324
.long("token")
267325
.help(
268-
"The token used to communicate with the Mozilla API. If unspecified, a web page \
269-
will be opened to retrieve the token. the MOZ_TOKEN environment variable can \
270-
also be used instead.",
271-
).env("MOZ_TOKEN")
326+
"The token used to communicate with the Mozilla API. If unspecified, a web \
327+
page will be opened to retrieve the token. the MOZ_TOKEN environment \
328+
variable can also be used instead.",
329+
)
330+
.env("MOZ_TOKEN")
331+
.global(true),
332+
)
333+
.arg(
334+
Arg::with_name("no-browser")
335+
.long("no-browser")
336+
.help(
337+
"By default, mozwire will open the login page in a browser, this option \
338+
prevents mozwire a browser page from being opened.",
339+
)
340+
.takes_value(false)
272341
.global(true),
273-
).arg(
274-
Arg::with_name("no-browser").long("no-browser").help("By default, mozwire will open the login page in a browser, this option prevents mozwire a browser page from being opened.").takes_value(false).global(true)
275342
)
276343
.global_setting(AppSettings::ColoredHelp)
277344
.setting(AppSettings::ArgRequiredElseHelp)

0 commit comments

Comments
 (0)