88
99year=$( date +%Y)
1010version=$1
11+ verbose=${2:- quiet}
12+
13+ # helpers
14+ reset=" \e[0m"
15+ red=" \e[31m"
16+ yellow=" \e[33m"
17+ blue=" \e[36m"
18+ bold=" \e[1m"
19+ function print_file() {
20+ if [ $verbose == " verbose" ]; then
21+ echo -e " $yellow $file :$reset "
22+ else
23+ echo -e " $yellow $file$reset "
24+ fi
25+ }
26+
27+ function print_verbose() {
28+ if [ $verbose == " verbose" ]; then
29+ echo -ne " $blue "
30+ grep " $1 " $2
31+ echo -e " $reset "
32+ fi
33+ }
1134
1235if [[ ! -z $version ]]; then
1336
@@ -21,29 +44,40 @@ if [[ ! -z $version ]]; then
2144
2245 echo " Updating Version in:"
2346
24- echo " CMakeLists.txt"
25- sed -i " /liblcf VERSION/,1 s/[0-9]\.[0-9]\.[0-9]/$version /" CMakeLists.txt
47+ file=CMakeLists.txt
48+ print_file
49+ sed -i " /liblcf VERSION/,1 s/[0-9]\(.[0-9]\)\{1,2\}/$version /" $file
50+ print_verbose ' liblcf VERSION' $file
2651
27- echo " configure.ac"
28- sed -i " /AC_INIT/,1 s/[0-9]\.[0-9]\.[0-9]/$version /" configure.ac
29-
30- echo " README.md"
31- sed -i " s/\(liblcf-\)[0-9]\.[0-9]\.[0-9]/\1$version /g" README.md
52+ file=configure.ac
53+ print_file
54+ sed -i " /AC_INIT/,1 s/[0-9]\(.[0-9]\)\{1,2\}/$version /" $file
55+ print_verbose ' AC_INIT' $file
3256
57+ file=README.md
58+ print_file
59+ sed -i " s/\(liblcf-\)[0-9]\(.[0-9]\)\{1,2\}/\1$version /g" $file
60+ print_verbose ' liblcf-' $file
3361else
3462
3563 echo " No new version argument, only updating copyright years!"
3664
3765fi
3866
3967echo " Updating License…"
40- sed -i " 1,1 s/2014-2[0-9][0-9][0-9]/2014-$year /" COPYING
4168
42- cat << EOF
69+ file=COPYING
70+ print_file
71+ sed -i " 1,1 s/2014-2[0-9][0-9][0-9]/2014-$year /" $file
72+ print_verbose ' 2014-' $file
73+
74+ echo -e " $(
75+ cat << EOM
4376
4477${red} Please check ${bold} README.md${reset}${red} file for whitespace problems.${reset}
4578
4679If everything is ready and committed, use these commands to publish the git tag:
47- $ git tag -a (-s) $version -m "Codename \"\ fancy codename\""
80+ $ git tag -a (-s) $version -m "Codename \"fancy codename\""
4881$ git push (-n) --tags upstream
49- EOF
82+ EOM
83+ ) "
0 commit comments