Skip to content

Commit

Permalink
merged changes in qr-opt for cargo format and got rid of useless comment
Browse files Browse the repository at this point in the history
  • Loading branch information
jherzstein committed Dec 9, 2024
2 parents 433f958 + 126bf19 commit cf93fd4
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,12 @@ async fn main() -> eyre::Result<()> {
match app.command {
WormholeCommand::Send {
common,
common_leader: CommonLeaderArgs { code, code_length , no_qr },
common_leader:
CommonLeaderArgs {
code,
code_length,
no_qr,
},
common_send: CommonSenderArgs { file_name, files },
..
} => {
Expand Down Expand Up @@ -332,7 +337,12 @@ async fn main() -> eyre::Result<()> {
tries,
timeout,
common,
common_leader: CommonLeaderArgs { code, code_length, no_qr },
common_leader:
CommonLeaderArgs {
code,
code_length,
no_qr,
},
common_send: CommonSenderArgs { file_name, files },
..
} => {
Expand Down Expand Up @@ -407,7 +417,12 @@ async fn main() -> eyre::Result<()> {
WormholeCommand::Forward(ForwardCommand::Serve {
targets,
common,
common_leader: CommonLeaderArgs { code, code_length, no_qr },
common_leader:
CommonLeaderArgs {
code,
code_length,
no_qr,
},
..
}) => {
// TODO make fancy
Expand Down Expand Up @@ -488,8 +503,10 @@ async fn main() -> eyre::Result<()> {
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.");
let mut app_config = forwarding::APP_CONFIG;
app_config.app_version.transit_abilities = parse_transit_args(&common);
let (wormhole, _code, relay_hints) =
parse_and_connect(&mut term, common, code, None, false, false, app_config, None).await?;
let (wormhole, _code, relay_hints) = parse_and_connect(
&mut term, common, code, None, false, false, app_config, None,
)
.await?;

let offer = forwarding::connect(
wormhole,
Expand Down Expand Up @@ -555,7 +572,8 @@ fn parse_transit_args(args: &CommonArgs) -> transit::Abilities {
}
}

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

/**
* Parse the necessary command line arguments to establish an initial server connection.
Expand All @@ -570,7 +588,6 @@ async fn parse_and_connect(
common_args: CommonArgs,
mut code: Option<String>,
code_length: Option<usize>,
//commnon_leader_args: CommonLeaderArgs,
no_qr: bool,
is_send: bool,
mut app_config: magic_wormhole::AppConfig<impl serde::Serialize + Send + Sync + 'static>,
Expand Down Expand Up @@ -798,7 +815,8 @@ fn sender_print_code(
if no_qr {
writeln!(term, "QR option not enabled. Skipping QR code generation.")?;
} else {
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)?;
}

Expand Down

0 comments on commit cf93fd4

Please sign in to comment.