aboutsummaryrefslogtreecommitdiffhomepage
path: root/threadcat
blob: 16c477a75305b6f73a65c599d36a4f3c439a8398 (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
#!/bin/bash

THREADCAT_SUBCOMMAND=$1

if [ -z "${THREADCAT_USER}" ]; then
    echo "The THREADCAT_USER environment variable is not set."
    echo "This should be something like user@host.com"
    exit 0
fi

if [ -z "${THREADCAT_SUBCOMMAND}" ]; then
    echo "USAGE: threadcat <COMMAND> [BOARD] [THREAD]"
    echo commands are:
    echo "  list [BOARD]            lists threads, most recent first"
    echo "  read [BOARD] THREAD     reads a thread, printing to stdout"
    echo "  write [BOARD] THREAD    posts to THREAD from stdin"
    echo "  del [BOARD] THREAD      delete a thread"
    exit 0
fi

case "$THREADCAT_SUBCOMMAND" in
    "list" ) threadcat-list.sh $2 ;;
    "read" ) threadcat-read.sh $2 $3 ;;
    "write" ) threadcat-write.sh $2 $3 ;;
    "del" ) threadcat-del.sh $2 $3 ;;
    * ) echo Unknown subcommand $THREADCAT_SUBCOMMAND
        echo commands are list, read, write, del;;
esac