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/preferences | |
parent | d402c7b9acd03c9bf8cb4ac9fc4581839cc540b0 (diff) | |
download | keyringer-72f6db37961e30117818c1d030a7c69869928028.tar.gz keyringer-72f6db37961e30117818c1d030a7c69869928028.tar.bz2 |
FHS compliance (closes #18)
Diffstat (limited to 'lib/keyringer/actions/preferences')
-rwxr-xr-x | lib/keyringer/actions/preferences | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/keyringer/actions/preferences b/lib/keyringer/actions/preferences new file mode 100755 index 0000000..e82848d --- /dev/null +++ b/lib/keyringer/actions/preferences @@ -0,0 +1,37 @@ +#!/bin/bash +# +# Manipulate preferences. +# + +# Load functions +LIB="`dirname $0`/../functions" +source "$LIB" || exit 1 + +COMMAND="$2" + +if [ -z "$COMMAND" ]; then + echo "Usage: keyringer <keyring> preferences <command> [arguments]" + echo "Available commands:" + echo " ls" + echo " edit" + echo " add" + exit 1 +fi + +# Create options file if old repository +if [ ! -e "$PREFERENCES" ]; then + echo "Creating preferences file..." + touch "$PREFERENCES" +fi + +if [ "$COMMAND" == "ls" ]; then + cat "$PREFERENCES" +elif [ "$COMMAND" == "edit" ]; then + "$EDITOR" "$PREFERENCES" +elif [ "$COMMAND" == "add" ]; then + shift 2 + [[ -n $* ]] && echo $* >> "$PREFERENCES" +else + printf "%s: No such command %s\n" "$BASENAME" "$COMMAND" + exit 1 +fi |