Skip to content
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

qr code generation optional argument #277

Merged
merged 12 commits into from
Dec 12, 2024
Prev Previous commit
Next Next commit
cargo format
jherzstein committed Dec 7, 2024
commit d60f12ccbe3f68161b049388abbe81f32e19df20
3 changes: 2 additions & 1 deletion cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -289,7 +289,7 @@
.init();
};

match app.command {

Check warning on line 292 in cli/src/main.rs

GitHub Actions / Cargo Format

Diff in /home/runner/work/magic-wormhole.rs/magic-wormhole.rs/cli/src/main.rs
WormholeCommand::Send {
common,
common_leader: CommonLeaderArgs { code, code_length , qr },
@@ -302,7 +302,7 @@
let (wormhole, _code, relay_hints) = match util::cancellable(
Box::pin(parse_and_connect(
&mut term,
common,

Check warning on line 305 in cli/src/main.rs

GitHub Actions / Cargo Format

Diff in /home/runner/work/magic-wormhole.rs/magic-wormhole.rs/cli/src/main.rs
code,
Some(code_length),
qr,
@@ -329,7 +329,7 @@
},
#[allow(unused_variables)]
WormholeCommand::SendMany {
tries,

Check warning on line 332 in cli/src/main.rs

GitHub Actions / Cargo Format

Diff in /home/runner/work/magic-wormhole.rs/magic-wormhole.rs/cli/src/main.rs
timeout,
common,
common_leader: CommonLeaderArgs { code, code_length, qr },
@@ -404,7 +404,7 @@
))
.await?;
},
WormholeCommand::Forward(ForwardCommand::Serve {

Check warning on line 407 in cli/src/main.rs

GitHub Actions / Cargo Format

Diff in /home/runner/work/magic-wormhole.rs/magic-wormhole.rs/cli/src/main.rs
targets,
common,
common_leader: CommonLeaderArgs { code, code_length, qr },
@@ -485,7 +485,7 @@
..
}) => {
// TODO make fancy
tracing::warn!("This is an unstable feature. Make sure that your peer is running the exact same version of the program as you. Also, please report all bugs and crashes.");

Check warning on line 488 in cli/src/main.rs

GitHub Actions / Cargo Format

Diff in /home/runner/work/magic-wormhole.rs/magic-wormhole.rs/cli/src/main.rs
let mut app_config = forwarding::APP_CONFIG;
app_config.app_version.transit_abilities = parse_transit_args(&common);
let (wormhole, _code, relay_hints) =
@@ -552,7 +552,7 @@
(true, false) => transit::Abilities::FORCE_DIRECT,
(false, true) => transit::Abilities::FORCE_RELAY,
(true, true) => unreachable!("These flags are mutually exclusive"),
}

Check warning on line 555 in cli/src/main.rs

GitHub Actions / Cargo Format

Diff in /home/runner/work/magic-wormhole.rs/magic-wormhole.rs/cli/src/main.rs
}

type PrintCodeFn = dyn Fn(&mut Term, &magic_wormhole::Code, &Option<url::Url>, bool) -> eyre::Result<()>;
@@ -796,7 +796,8 @@

writeln!(term, "This is equivalent to the following link: \u{001B}]8;;{}\u{001B}\\{}\u{001B}]8;;\u{001B}\\", &uri, &uri)?;
if qr {
let qr_code = qr2term::generate_qr_string(&uri).context("Failed to generate QR code for send link")?;
let qr_code = qr2term::generate_qr_string(&uri)
.context("Failed to generate QR code for send link")?;
writeln!(term, "{}", qr_code)?;
} else {
writeln!(term, "QR option not enabled. Skipping QR code generation.")?;