mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 12:56:30 +03:00
feat(deltachat-repl): print send-backup QR code to the terminal
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
#![allow(clippy::format_push_string)]
|
#![allow(clippy::format_push_string)]
|
||||||
extern crate dirs;
|
extern crate dirs;
|
||||||
|
|
||||||
|
use std::io::Write;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
use std::process::Command;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
@@ -487,8 +489,14 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
|
|||||||
}
|
}
|
||||||
"send-backup" => {
|
"send-backup" => {
|
||||||
let provider = BackupProvider::prepare(&context).await?;
|
let provider = BackupProvider::prepare(&context).await?;
|
||||||
let qr = provider.qr();
|
let qr = format_backup(&provider.qr())?;
|
||||||
println!("QR code: {}", format_backup(&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?;
|
provider.await?;
|
||||||
}
|
}
|
||||||
"receive-backup" => {
|
"receive-backup" => {
|
||||||
|
|||||||
Reference in New Issue
Block a user