-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathversion
executable file
·57 lines (40 loc) · 1.13 KB
/
version
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
57
#! /usr/bin/env perl
=head1 NAME
version - tell which version of the multigraph userguide this is
=head1 SYNOPSIS
version [-c]
=head1 OVERVIEW
This short script simply prints out the version tag of this copy of
the multigraph userguide. (It finds this version tag by examining the
URL from which this copy of was checked out from subversion.)
=head1 OPTIONS
=over 4
=item -c
Concise output: just print the version tag, rather than a complete
sentence.
=back
=cut
# Subversion will automatically replace the following string with the
# repository URL corresponding to this file (using keyword expansion):
my $URL = '$URL$';
my $concise = ($ARGV[0] eq "-c");
my $version = "unknown";
if ($URL =~ m|/trunk/|) {
$version = "trunk";
} elsif ( my ($v) = ($URL =~ m|/tags/([^/]+)/|) ) {
$v =~ s/^multigraph-userguide-//i;
$version = $v;
}
if ($concise) {
if ($version eq "trunk") {
print "trunk\n";
} else {
print "$version\n";
}
} else {
if ($version eq "trunk") {
print "This is the trunk version of the multigraph userguide.\n";
} else {
print "This is version $version of the multigraph userguide.\n";
}
}