This commit is contained in:
Dennis Schwerdel 2017-03-22 18:21:48 +01:00 committed by Dennis Schwerdel
parent 205c193108
commit 6f5cb66065
2 changed files with 6 additions and 5 deletions

View File

@ -261,8 +261,8 @@ pub fn parse() -> Arguments {
(@subcommand addkey => (@subcommand addkey =>
(about: "adds a key to the respository") (about: "adds a key to the respository")
(@arg REPO: +required "path of the repository") (@arg REPO: +required "path of the repository")
(@arg generate: --generate "generate a new key") (@arg generate: --generate -g "generate a new key")
(@arg set_default: --default "set this key as default") (@arg set_default: --default -d "set this key as default")
(@arg FILE: +takes_value "the file containing the keypair") (@arg FILE: +takes_value "the file containing the keypair")
) )
(@subcommand algotest => (@subcommand algotest =>

View File

@ -146,13 +146,14 @@ pub fn run() {
}, remote_path).unwrap(); }, remote_path).unwrap();
if encryption { if encryption {
let (public, secret) = gen_keypair(); let (public, secret) = gen_keypair();
println!("Public key: {}", to_hex(&public[..])); println!("public: {}", to_hex(&public[..]));
println!("Secret key: {}", to_hex(&secret[..])); println!("secret: {}", to_hex(&secret[..]));
repo.set_encryption(Some(&public)); repo.set_encryption(Some(&public));
repo.register_key(public, secret).unwrap(); repo.register_key(public, secret).unwrap();
repo.save_config().unwrap(); repo.save_config().unwrap();
print_config(&repo.config); println!();
} }
print_config(&repo.config);
}, },
Arguments::Backup{repo_path, backup_name, src_path, full, reference} => { Arguments::Backup{repo_path, backup_name, src_path, full, reference} => {
let mut repo = open_repository(&repo_path); let mut repo = open_repository(&repo_path);