From d7ed89da4cf4d2d20910534c06af16cd96b78559 Mon Sep 17 00:00:00 2001 From: Ben Watson Date: Mon, 12 Dec 2016 14:07:33 +0000 Subject: [PATCH] Requiring a file to be entered to finish editing (#175) * Requiring a file to be entered to finish editing Running blackbox_edit_end without an argument doesn't currently print out a warning that no files are being changed. A developer in my team who was new to Blackbox committed a decrypted file (and made no changes to the GPG file) as they didn't realise the command hadn't worked. The check I've added should help to avoid these errors. * Adding argument check to start editing --- bin/blackbox_edit_end | 5 +++++ bin/blackbox_edit_start | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/bin/blackbox_edit_end b/bin/blackbox_edit_end index 618d13a..14f4609 100755 --- a/bin/blackbox_edit_end +++ b/bin/blackbox_edit_end @@ -9,6 +9,11 @@ source "${0%/*}/_blackbox_common.sh" next_steps=() +if [ $# -eq 0 ]; then + echo >&2 "Please provide at least one file for which editing has finished" + exit 1 +fi + for param in "$@" ; do unencrypted_file=$(get_unencrypted_filename "$param") diff --git a/bin/blackbox_edit_start b/bin/blackbox_edit_start index 79df67f..6f61e13 100755 --- a/bin/blackbox_edit_start +++ b/bin/blackbox_edit_start @@ -7,6 +7,11 @@ set -e source "${0%/*}/_blackbox_common.sh" +if [ $# -eq 0 ]; then + echo >&2 "Please provide at least one file to start editing" + exit 1 +fi + for param in "$@" ; do unencrypted_file=$(get_unencrypted_filename "$param")