aboutsummaryrefslogtreecommitdiff
path: root/share/keyringer/options
blob: 20a98915c467520f04b488d1355cb61f6f941658 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
#
# Recipient management.
#

# Config
ACTIONS="`dirname $0`"
BASEDIR="$1"
COMMAND="$2"
BASENAME="`basename $0`"
OPTIONS="$BASEDIR/config/options"

# Load functions
LIB="`dirname $0`/../../lib/keyringer"
source $LIB/functions

if [ -z "$COMMAND" ]; then
  echo "Usage: keyringer <keyring> `basename $0` <command> [arguments]"
  exit 1
fi

# Create options file if old repository
if [ ! -e "$OPTIONS" ]; then
  echo "Creating options file..."
  touch $OPTIONS
  keyringer_exec git $BASEDIR add config/options
fi

if [ "$COMMAND" == "ls" ]; then
  cat $OPTIONS
elif [ "$COMMAND" == "edit" ]; then
  $EDITOR $OPTIONS
elif [ "$COMMAND" == "add" ]; then
  shift 2
  echo $* >> $OPTIONS 
else
  echo "$BASENAME: No such command $COMMAND"
  exit 1
fi