File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
2
3
+ set -e
4
+
3
5
if [ -z " $1 " ]; then
4
6
echo " Usage: ./txpull <po file path> [<options or arguments for tx pull>]"
5
7
exit 1
6
8
fi
7
9
8
- if [ ! -f " $1 " ]; then
9
- echo " File $1 does not exist"
10
- exit 1
10
+ if [ -f " $1 " ]; then
11
+ file=$1
12
+ elif [ -n " $( cat .tx/config | grep " \[python-36-tw\.$1 \]" ) " ]; then
13
+ file=$( cat .tx/config | grep -A 3 " \[python-36-tw\.$1 ]" | grep " trans.zh_TW = " | sed ' s/trans\.zh_TW = //' )
14
+ else
15
+ echo " Cannot find file or resource $1 "
16
+ exit 1
11
17
fi
12
18
13
- file= " $1 "
19
+ resource_slug= $( cat .tx/config | grep -B 3 $file | grep " python-36-tw " | head -n 1 | sed ' s/\[\(.*\)\]/\1/ ' )
14
20
shift
15
21
16
- resource_slug=" $( cat .tx/config | grep -B 3 $file | grep " python-36-tw" | head -n 1 | sed ' s/\[\(.*\)\]/\1/' ) "
17
22
if [ -z " $resource_slug " ]; then
18
- echo " Resource of file $file not found "
23
+ echo " Cannot find resource slug of $file "
19
24
exit 1
20
25
fi
21
26
You can’t perform that action at this time.
0 commit comments