21 lines
386 B
Bash
Executable File
21 lines
386 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
|
|
repo=https://github.com/skk-dev/dict.git
|
|
dest=${1:-skkdicts}
|
|
revision=${2:-}
|
|
|
|
if [ "$#" -gt 2 ] || [ -z "$dest" ]; then
|
|
echo "usage: $0 [destination [revision]]" >&2
|
|
exit 2
|
|
fi
|
|
if [ -e "$dest" ]; then
|
|
echo "$0: destination already exists: $dest" >&2
|
|
exit 1
|
|
fi
|
|
|
|
git clone "$repo" "$dest"
|
|
if [ -n "$revision" ]; then
|
|
git -C "$dest" checkout --detach "$revision"
|
|
fi
|