]> gitweb.fluxo.info Git - keyringer.git/commitdiff
New function keyringer_get_new_file
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 18 Sep 2010 17:00:20 +0000 (14:00 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 18 Sep 2010 17:00:20 +0000 (14:00 -0300)
lib/keyringer/functions
share/keyringer/encrypt

index 9c37291485befcda2fc5daae290eaa7ec4051481..67bbc5023c674342bebfc5629b867cd904b79616 100644 (file)
@@ -213,6 +213,16 @@ function keyringer_get_file {
   fi
 }
 
+# Get a new file argument
+function keyringer_get_new_file {
+  FILE="`keyringer_filename $1`"
+  
+  if [ -z "$FILE" ]; then
+    keyringer_action_usage
+    exit 1
+  fi
+}
+
 # Run the action usage
 function keyringer_action_usage {
   if [ "`type -t "keyringer_usage_$BASENAME"`" == "function" ]; then
index 26b27105687385d8419eab9ce84c9b56443f2c83..b6d594cc02139679fd5b25ca11c322d515181267 100755 (executable)
@@ -8,13 +8,7 @@ LIB="`dirname $0`/../../lib/keyringer/functions"
 source $LIB || exit 1
 
 # Aditional parameters
-FILE="`keyringer_filename $2`"
-
-# Setup
-if [ -z "$FILE" ]; then
-  echo "Usage: keyringer <keyring> `basename $0` <file>"
-  exit 1
-fi
+FILE="`keyringer_get_new_file $2`"
 
 # Encrypt
 mkdir -p $KEYDIR/`dirname $FILE`