Skip to content

Commit

Permalink
feat(deltachat-repl): print send-backup QR code to the terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
link2xt committed Oct 4, 2024
1 parent 283a1f1 commit 650995d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions deltachat-repl/src/cmdline.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#![allow(clippy::format_push_string)]
extern crate dirs;

use std::io::Write;
use std::path::Path;
use std::process::Command;
use std::str::FromStr;
use std::time::Duration;

Expand Down Expand Up @@ -487,8 +489,14 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
}
"send-backup" => {
let provider = BackupProvider::prepare(&context).await?;
let qr = provider.qr();
println!("QR code: {}", format_backup(&qr)?);
let qr = format_backup(&provider.qr())?;
println!("QR code: {}", qr);
let output = Command::new("qrencode")
.args(["-t", "ansiutf8", qr.as_str(), "-o", "-"])
.output()
.expect("failed to execute process");
std::io::stdout().write_all(&output.stdout).unwrap();
std::io::stderr().write_all(&output.stderr).unwrap();
provider.await?;
}
"receive-backup" => {
Expand Down

0 comments on commit 650995d

Please sign in to comment.