1 | // $Id: OptionVersion.cc 733 2008-12-15 22:23:45Z peter $ |
---|
2 | |
---|
3 | /* |
---|
4 | Copyright (C) 2008 Peter Johansson |
---|
5 | |
---|
6 | This file is part of svndigest, http://dev.thep.lu.se/svndigest |
---|
7 | |
---|
8 | svndigest is free software; you can redistribute it and/or |
---|
9 | modify it under the terms of the GNU General Public License as |
---|
10 | published by the Free Software Foundation; either version 3 of the |
---|
11 | License, or (at your option) any later version. |
---|
12 | |
---|
13 | svndigest is distributed in the hope that it will be useful, |
---|
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
16 | General Public License for more details. |
---|
17 | |
---|
18 | You should have received a copy of the GNU General Public License |
---|
19 | along with svndigest. If not, see <http://www.gnu.org/licenses/>. |
---|
20 | */ |
---|
21 | |
---|
22 | #include <config.h> |
---|
23 | |
---|
24 | #include "copyright_year.h" |
---|
25 | #include "OptionVersion.h" |
---|
26 | #include "ColumnStream.h" |
---|
27 | #include "CommandLine.h" |
---|
28 | #include "subversion_info.h" |
---|
29 | #include "utility.h" |
---|
30 | |
---|
31 | #include <sstream> |
---|
32 | #include <string> |
---|
33 | |
---|
34 | namespace theplu { |
---|
35 | namespace svndigest { |
---|
36 | |
---|
37 | OptionVersion::OptionVersion(CommandLine& cmd, std::string flag, |
---|
38 | std::string desc, OptionSwitch* const verbose) |
---|
39 | : OptionSwitch(cmd, flag, desc, false), verbose_(verbose) |
---|
40 | { |
---|
41 | } |
---|
42 | |
---|
43 | |
---|
44 | void OptionVersion::do_parse2(std::vector<std::string>::iterator first, |
---|
45 | std::vector<std::string>::iterator last) |
---|
46 | { |
---|
47 | ColumnStream cs(std::cout, 1); |
---|
48 | cs.width(0)=79; |
---|
49 | cs << PACKAGE_NAME << " " << PACKAGE_VERSION; |
---|
50 | bool no_verbose = verbose_ && verbose_->present() && !verbose_->value(); |
---|
51 | if (!no_verbose) { |
---|
52 | cs << " ("; |
---|
53 | if (DEV_BUILD) |
---|
54 | cs << svn_revision() << " "; |
---|
55 | cs << "compiled " << compilation_time() << ", " << compilation_date() |
---|
56 | << ")"; |
---|
57 | } |
---|
58 | cs << "\n\nCopyright (C) " << svn_year() |
---|
59 | << " Jari H\u00E4kkinen and Peter Johansson.\n" |
---|
60 | << "This is free software. You may redistribute copies of it under " |
---|
61 | << "the terms of the GNU General Public License " |
---|
62 | << "<http://www.gnu.org/licenses/gpl.html>.\n" |
---|
63 | << "There is NO WARRANTY; to the extent permitted by law.\n"; |
---|
64 | exit(0); |
---|
65 | } |
---|
66 | |
---|
67 | }} // of namespace svndigest and theplu |
---|