diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-10-18 17:03:40 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-10-18 17:03:40 -0300 |
commit | 72f6db37961e30117818c1d030a7c69869928028 (patch) | |
tree | 713c32a61aaf3961cf842f113e8ecd711e10f555 /lib/keyringer/actions/recipients | |
parent | d402c7b9acd03c9bf8cb4ac9fc4581839cc540b0 (diff) | |
download | keyringer-72f6db37961e30117818c1d030a7c69869928028.tar.gz keyringer-72f6db37961e30117818c1d030a7c69869928028.tar.bz2 |
FHS compliance (closes #18)
Diffstat (limited to 'lib/keyringer/actions/recipients')
-rwxr-xr-x | lib/keyringer/actions/recipients | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/lib/keyringer/actions/recipients b/lib/keyringer/actions/recipients new file mode 100755 index 0000000..7093a6b --- /dev/null +++ b/lib/keyringer/actions/recipients @@ -0,0 +1,46 @@ +#!/bin/bash +# +# Recipient management. +# + +# Load functions +LIB="`dirname $0`/../functions" +source "$LIB" || exit 1 + +# Command parser +keyringer_get_command "$2" + +# Set recipients file +keyringer_set_new_recipients "$3" + +if [ "$COMMAND" == "ls" ]; then + if [ ! -z "$3" ]; then + if [ -e "$RECIPIENTS_FILE" ]; then + cat "$RECIPIENTS_FILE" + else + echo "Recipients file not found: $RECIPIENTS_FILE_BASE" + exit 1 + fi + else + for recipients in `ls $RECIPIENTS`; do + echo "In recipients file $recipients:" + echo "-----------------------------------------------------------------------------------" + cat $RECIPIENTS/$recipients + echo "" + done + fi +elif [ "$COMMAND" == "edit" ]; then + if [ ! -z "$3" ]; then + keyringer_create_new_recipients $RECIPIENTS_FILE + $EDITOR "$RECIPIENTS_FILE" + keyringer_check_recipients + keyringer_exec git "$BASEDIR" add "$RECIPIENTS_FILE_BASE" + else + echo "Please specify one recipient to edit among the available:" + ls $RECIPIENTS | sed -e 's/^/\t/' + exit 1 + fi +else + printf "%s: No such command %s\n" "$BASENAME" "$COMMAND" + exit 1 +fi |