summaryrefslogtreecommitdiff
path: root/tools/init-migration-file.sh
blob: c6a2b862e6b3cd392c2c97398a29d217e53c865d (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
#!/bin/bash

usage() {
		echo "$0 [-t type] [-n name]"
		echo "  type: [node | shell]"
		echo "  name: if no present, set untitled"
		exit 0
}

while getopts :t:n:h OPT
do
	case $OPT in
		t)	type=$OPTARG
				;;
		n)	name=$OPTARG
				;;
		h)	usage
				;;
		\?) usage
				;;
		:)	usage
				;;
	esac
done

if [ "$type" = "" ]
then
	echo "no type present!!!"
	usage
fi

if [ "$name" = "" ]
then
	name="untitled"
fi

touch "$(realpath $(dirname $BASH_SOURCE))/migration/$type.$(date +%s).$name.js"