aboutsummaryrefslogtreecommitdiff
path: root/lib/keyringer/actions/options
blob: eea73e812c4f0f5a97eff719c4c7258695b5a3dd (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
#!/usr/bin/env bash
#
# Repository options management.
#

# Load functions
LIB="`dirname $0`/../functions"
source "$LIB" || exit 1

# Command parser
keyringer_get_command "$2"

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

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