mirror of
https://github.com/rustic-rs/rustic.git
synced 2025-10-26 11:18:51 +00:00
option -p reads passwd from file
This commit is contained in:
parent
f5d4b24c47
commit
12eefc9acc
@ -1,3 +1,5 @@
|
||||
use std::fs;
|
||||
|
||||
use anyhow::Result;
|
||||
use clap::{Parser, Subcommand};
|
||||
|
||||
@ -16,9 +18,9 @@ struct Opts {
|
||||
#[clap(short, long)]
|
||||
repository: String,
|
||||
|
||||
/// password
|
||||
/// file to read the password from
|
||||
#[clap(short, long)]
|
||||
password: String,
|
||||
password_file: String,
|
||||
|
||||
#[clap(subcommand)]
|
||||
command: Command,
|
||||
@ -43,7 +45,8 @@ pub fn execute() -> Result<()> {
|
||||
let args = Opts::parse();
|
||||
|
||||
let be = LocalBackend::new(&args.repository);
|
||||
let key = repo::find_key_in_backend(&be, &args.password, None)?;
|
||||
let passwd = fs::read_to_string(&args.password_file)?.replace("\n","");
|
||||
let key = repo::find_key_in_backend(&be, &passwd, None)?;
|
||||
let dbe = DecryptBackend::new(&be, key);
|
||||
|
||||
match args.command {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user