Update Chinese translation
[enc.git] / gnun-add-fuzzy-diff
1 #! /bin/bash
2
3 # Copyright (C) 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
4
5 # This file is part of GNUnited Nations.
6
7 # GNUnited Nations is free software: you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License as
9 # published by the Free Software Foundation, either version 3 of the
10 # License, or (at your option) any later version.
11
12 # GNUnited Nations is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with GNUnited Nations. If not, see <http://www.gnu.org/licenses/>.
19
20 # Wraps around add-fuzzy-diff to provide a command line interface compliant
21 # with GNU Coding Standards
22
23 function version () {
24 cat <<EOF
25 gnun-add-fuzzy-diff (GNUnited Nations) 0.10
26 Copyright (C) 2014 Free Software Foundation, Inc.
27 You may redistribute copies of GNUnited Nations
28 under the terms of the GNU General Public License.
29 For more information about these matters, see the file named COPYING.
30 EOF
31 }
32
33 function usage () {
34 cat <<EOF
35 Usage: gnun-add-fuzzy-diff [OPTION...] [FILE]
36 Add comments with differences to previous msgids to fuzzy translations
37 in a PO file.
38
39 Options:
40 -i[SUFFIX], --in-place[=SUFFIX]
41 Edit files in place (makes backup if extension supplied)
42 -v, --version Display version info and exit
43 -h, --help Display this help and exit
44
45 Report bugs to bug-gnun@gnu.org
46 GNUnited Nations home page: <https://www.gnu.org/software/gnun/>
47 General help using GNU software: <http://www.gnu.org/gethelp/>
48 EOF
49 }
50
51 function single_file_needed () {
52 echo 1>&2 "$0:" Single FILE argument is required.
53 exit 1
54 }
55
56 in_place=
57 file=
58
59 while test $# -ge 1; do
60 case "$1" in
61 --help | -h )
62 usage
63 exit 0
64 ;;
65 --version | -v )
66 version
67 exit 0
68 ;;
69 -i* | --in-place=* | --in-place )
70 in_place="$1"
71 ;;
72 -- )
73 shift
74 break
75 ;;
76 -* )
77 echo 1>&2 "$0:" Invalid option -- \'$1\'.
78 exit 1
79 ;;
80 * )
81 if test "x$file" = x; then
82 file="$1"
83 else
84 single_file_needed
85 fi
86 ;;
87 esac
88 shift
89 done
90
91 if test "x$file" = x; then
92 if test $# -lt 1; then
93 single_file_needed
94 else
95 file="$1"
96 shift
97 fi
98 fi
99 if test $# -gt 0; then
100 single_file_needed
101 fi
102
103 /usr/local/libexec/gnun/add-fuzzy-diff $in_place "$file"
104
105 exit $?