kook/bin/kotam
Glenn Y. Rolland 95f1e4f036 Rename project.
2013-06-04 16:08:18 +02:00

51 lines
974 B
Bash
Executable file

#!/bin/sh
KOTAM_DATA_DIR=$(cd `dirname "$0"`; cd ../lib ; pwd )
KOTAM_CONFIG_DIR=$HOME/.config/kotam
. $KOTAM_DATA_DIR/base.sh
## Expected usage :
#
# kotam exec <name>
# kotam init <name>
#
mkdir -p $KOTAM_CONFIG_DIR
while [ $# -gt 0 ]; do
arg=${1:-}
opt=${2:-}
case $arg in
-l|--list) #list projects
echo "List of projects :"
ls $KOTAM_CONFIG_DIR/*.kotam 2> /dev/null
;;
-e) # edit project
shift
project="$opt"
if [ -z "$project" ]; then
echo "ERROR: project name missing" >&2
exit 1
elif [ ! -e "$KOTAM_CONFIG_DIR/$project.kotam" ]; then
echo "ERROR: unknown project $project" >&2
exit 1
fi
"$EDITOR" "$KOTAM_CONFIG_DIR/$project.kotam"
;;
-c) # create
;;
-d) # destroy
;;
*) #enter into project
project="$arg"
if [ ! -e "$KOTAM_CONFIG_DIR/$project.kotam" ]; then
echo "ERROR: unknown project $project" >&2
exit 1
fi
. "$KOTAM_CONFIG_DIR/$project.kotam"
;;
esac
shift
done