From 1cd58e180d359d34160e23bf87c8ca5cc7369b11 Mon Sep 17 00:00:00 2001 From: Dennis Schwerdel Date: Thu, 11 May 2017 09:36:44 +0200 Subject: [PATCH] Changed addkey arguments --- .gitignore | 1 + CHANGELOG.md | 5 +++++ docs/man/zvault-addkey.1.md | 8 +++++--- src/cli/args.rs | 10 +++++----- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index d9d081d..8c0b983 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ restored excludes ._* .~* +docs/logo diff --git a/CHANGELOG.md b/CHANGELOG.md index e50b7aa..ea1fe35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ This project follows [semantic versioning](http://semver.org). +### UNRELEASED +* [modifed] Changed order of arguments in `addkey` to match src-dst scheme +* [fixed] Fixed `addkey` subcommand + + ### v0.3.1 (2017-05-09) * [added] Derive key pairs from passwords * [modified] Added root repository to exclude list diff --git a/docs/man/zvault-addkey.1.md b/docs/man/zvault-addkey.1.md index d8196bc..764c99b 100644 --- a/docs/man/zvault-addkey.1.md +++ b/docs/man/zvault-addkey.1.md @@ -3,7 +3,7 @@ zvault-addkey(1) -- Add a key pair to the repository ## SYNOPSIS -`zvault addkey [OPTIONS] [FILE]` +`zvault addkey [OPTIONS] [FILE] ` ## DESCRIPTION @@ -14,7 +14,8 @@ If `FILE` is given, the key pair is read from the file and added to the repository. If `--generate` is set, a new key pair is generated, printed to console and -added to the repository. +added to the repository. If `--password` is also set, the key pair will be +derived from the given password instead of creating a random one. If `--default` is set, encryption will be enabled (if not already) and the new key will be set as default encryption key. @@ -35,7 +36,8 @@ key will be set as default encryption key. * `-p`, `--password `: Derive the key pair from the given password instead of randomly creating it. - + This setting requires that `--generate` is set too. + * `-h`, `--help`: diff --git a/src/cli/args.rs b/src/cli/args.rs index 63a301c..72b70d4 100644 --- a/src/cli/args.rs +++ b/src/cli/args.rs @@ -405,14 +405,14 @@ pub fn parse() -> Result<(LogLevel, Arguments), ErrorCode> { .arg(Arg::from_usage("[FILE] 'Destination file for the keypair'"))) .subcommand(SubCommand::with_name("addkey").about("Add a key pair to the repository") .arg(Arg::from_usage("-g --generate 'Generate a new key pair'") - .conflicts_with_all(&["FILE", "PASSWORD"])) + .conflicts_with("FILE")) .arg(Arg::from_usage("[set_default] --default -d 'Set the key pair as default'")) .arg(Arg::from_usage("-p --password [PASSWORD] 'Derive the key pair from the given password'") - .conflicts_with("FILE")) - .arg(Arg::from_usage(" 'Path of the repository'") - .validator(|val| validate_repo_path(val, true, Some(false), Some(false)))) + .requires("generate")) .arg(Arg::from_usage("[FILE] 'File containing the keypair'") - .validator(validate_existing_path))) + .validator(validate_existing_path)) + .arg(Arg::from_usage(" 'Path of the repository'") + .validator(|val| validate_repo_path(val, true, Some(false), Some(false))))) .subcommand(SubCommand::with_name("algotest").about("Test a specific algorithm combination") .arg(Arg::from_usage("[bundle_size] --bundle-size [SIZE] 'Set the target bundle size in MiB'") .default_value(DEFAULT_BUNDLE_SIZE_STR).validator(validate_num))