aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxPMo <PMo_@vivaldi.net>2018-05-21 17:11:28 -0500
committerTad Fisher <tadfisher@gmail.com>2018-06-03 18:57:38 -0700
commitcae5d5088ef5056ab3d3e4c144ec1b02d4ee2d3d (patch)
treebc2d5b918a5f1d33363d7e84db1f3a0fcaf9d4f6
parent938f7fd3b6ab4a4c6008ef84e47f9449cc792625 (diff)
Fix behaviour for otp append as well
-rwxr-xr-xotp.bash6
1 files changed, 5 insertions, 1 deletions
diff --git a/otp.bash b/otp.bash
index 5c06dc5..72e3aa2 100755
--- a/otp.bash
+++ b/otp.bash
@@ -273,7 +273,11 @@ cmd_otp_append() {
[[ -n "$existing" ]] && yesno "An OTP secret already exists for $path. Overwrite it?"
if [[ $from_secret -eq 1 ]]; then
- ([[ -z "$issuer" ]] || [[ -z "$account" ]]) && die "Missing issuer or account"
+ [ -z "$issuer" ] && issuer=false
+ [ -z "$account" ] && account=false
+
+ [ "$issuer" = false ] && [ "$account" = false ] && die "Missing one of either '--issuer' or '--account'"
+
otp_read_secret "$prompt" $echo "$issuer" "$account"
else
otp_read_uri "$prompt" $echo