forked from fwolf/copyright-year-updater.sh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopyright-year-updater.sh
executable file
·56 lines (40 loc) · 1.06 KB
/
copyright-year-updater.sh
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env bash
#====================================================================
# copyright-year-updater.sh
#
# Copyright 2015-2017 Fwolf <[email protected]>
# All rights reserved.
#
# Distributed under the MIT License.
# http://opensource.org/licenses/MIT
#
# For copyright year style, see:
# https://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html
# For quick view, run 'bc' and see its copyright notice.
#====================================================================
VERSION=0.2.4
self="$0"
if [ -L "$self" ]; then
self=$(readlink "$self")
self=$(realpath "$self")
fi
P2R=${self%/*}/
source ${P2R}lib/parse-options.sh
source ${P2R}lib/update-file.sh
function PrintUsage {
PROGNAME=$(basename "$self")
cat <<-EOF
${PROGNAME} ${VERSION}
Usage: ${PROGNAME} [Options] [File]
Options:
-y, --year Copyright end year, default is current year
All options must set before [File].
EOF
}
if [ $# -lt 1 ]; then
PrintUsage
exit 1
fi
ParseOptions "$@" && shift $(($OPTIND - 1))
UpdateFile "$1"
exit 0