File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ #
3+ # Copyright 2018 coord.e
4+ #
5+ # This file is part of servoarray.
6+ #
7+ # servoarray is free software: you can redistribute it and/or modify
8+ # it under the terms of the GNU General Public License as published by
9+ # the Free Software Foundation, either version 3 of the License, or
10+ # (at your option) any later version.
11+ #
12+ # servoarray 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 servoarray. If not, see <http://www.gnu.org/licenses/>.
19+ #
20+ # This script prints semver-compatible version string calculated from current state of git
21+
22+ set -euo pipefail
23+
24+ cd " $( dirname " $0 " ) "
25+
26+ function detailed() {
27+ local annotated=$( git describe --tags --abbrev=0 2> /dev/null)
28+ local description=$( git describe --always)
29+ local replaced=${description/ ${annotated} -/ ${annotated} +}
30+ local semver=${replaced# v}
31+ echo $semver
32+ }
33+
34+ function simple() {
35+ local annotated=$( git describe --tags --abbrev=0 2> /dev/null)
36+ echo ${annotated# v}
37+ }
38+
39+ ${1:- detailed}
You can’t perform that action at this time.
0 commit comments