updated my personal email address
[enc.git] / gnun-add-fuzzy-diff
CommitLineData
b7598051
TG
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
23function version () {
24cat <<EOF
25gnun-add-fuzzy-diff (GNUnited Nations) 0.10
26Copyright (C) 2014 Free Software Foundation, Inc.
27You may redistribute copies of GNUnited Nations
28under the terms of the GNU General Public License.
29For more information about these matters, see the file named COPYING.
30EOF
31}
32
33function usage () {
34cat <<EOF
35Usage: gnun-add-fuzzy-diff [OPTION...] [FILE]
36Add comments with differences to previous msgids to fuzzy translations
37in a PO file.
38
39Options:
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
45Report bugs to bug-gnun@gnu.org
46GNUnited Nations home page: <https://www.gnu.org/software/gnun/>
47General help using GNU software: <http://www.gnu.org/gethelp/>
48EOF
49}
50
51function single_file_needed () {
52 echo 1>&2 "$0:" Single FILE argument is required.
53 exit 1
54}
55
53e5116e 56ADD_FUZZY_DIFF=./add-fuzzy-diff
b7598051
TG
57in_place=
58file=
59
60while test $# -ge 1; do
61 case "$1" in
62 --help | -h )
63 usage
64 exit 0
65 ;;
66 --version | -v )
67 version
68 exit 0
69 ;;
70 -i* | --in-place=* | --in-place )
71 in_place="$1"
72 ;;
73 -- )
74 shift
75 break
76 ;;
77 -* )
78 echo 1>&2 "$0:" Invalid option -- \'$1\'.
79 exit 1
80 ;;
81 * )
82 if test "x$file" = x; then
83 file="$1"
84 else
85 single_file_needed
86 fi
87 ;;
88 esac
89 shift
90done
91
92if test "x$file" = x; then
93 if test $# -lt 1; then
94 single_file_needed
95 else
96 file="$1"
97 shift
98 fi
99fi
100if test $# -gt 0; then
101 single_file_needed
102fi
103
53e5116e 104$ADD_FUZZY_DIFF $in_place "$file"
b7598051
TG
105
106exit $?