From e6c2c7ed93ee019f4113217bbe6e3b8fb2b3f208 Mon Sep 17 00:00:00 2001 From: louib Date: Wed, 18 Mar 2020 21:51:36 -0400 Subject: [PATCH] CLI: Cleanup create options (#4313) * Add ability to create database with an empty password * Add password repeat check * Standardize process between `db-create` and `import` commands * Improve db-create tests with new password repeat Co-authored-by: Jonathan White --- CHANGELOG.md | 2 + share/docs/man/keepassxc-cli.1 | 8 +- src/cli/Create.cpp | 37 ++++++--- src/cli/Create.h | 2 + src/cli/Import.cpp | 8 +- src/cli/Utils.cpp | 32 +++++++- src/cli/Utils.h | 2 +- tests/TestCli.cpp | 134 ++++++++++++++++++++++++--------- 8 files changed, 171 insertions(+), 54 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76bb5c38b..6bdcb5bf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ ### Changed - Renamed CLI create command to db-create [#4231] +- Added --set-password option for CLI db-create command +- Added --set-key-file option for CLI db-create command (replacing --key-file option) ## 2.5.3 (2020-01-19) diff --git a/share/docs/man/keepassxc-cli.1 b/share/docs/man/keepassxc-cli.1 index d1360cd65..bac9a8d37 100644 --- a/share/docs/man/keepassxc-cli.1 +++ b/share/docs/man/keepassxc-cli.1 @@ -29,7 +29,7 @@ Copies an attribute or the current TOTP (if the \fI-t\fP option is specified) of In interactive mode, closes the currently opened database (see \fIopen\fP). .IP "\fBdb-create\fP [options] " -Creates a new database with a key file and/or password. The key file will be created if the file that is referred to does not exist. If both the key file and password are empty, no database will be created. +Creates a new database with a password and/or a key file. The key file will be created if the file that is referred to does not exist. If both the key file and password are empty, no database will be created. .IP "\fBdb-info\fP [options] " Show a database's information. @@ -185,6 +185,12 @@ Will report an error if no TOTP is configured for the entry. .SS "Create options" +.IP "\fB-k\fP, \fB--set-key-file\fP " +Set the key file for the database. + +.IP "\fB-p\fP, \fB--set-password\fP" +Set a password for the database. + .IP "\fB-t\fP, \fB--decryption-time\fP