source: trunk/lib/OptionVersion.cc @ 724

Last change on this file since 724 was 724, checked in by Peter Johansson, 13 years ago
  • README.developer: adding text on Requirements for building from svn checkout
  • configure.ac: support for help2man and new man/Makefile
  • lib/OptionVersion.cc lib/OptionVersion.h bin/Parameter.cc: changed --version output so when used in combination with --no-verbose it is compliant with help2man
  • lib/utility.cc: removed function version_string not used anymore

closes #361

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1// $Id: OptionVersion.cc 724 2008-12-09 13:34:16Z 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 "OptionVersion.h"
25#include "ColumnStream.h"
26#include "CommandLine.h"
27#include "subversion_info.h"
28#include "utility.h"
29
30#include <sstream>
31#include <string>
32
33namespace theplu {
34namespace svndigest {
35
36  OptionVersion::OptionVersion(CommandLine& cmd, std::string flag, 
37                               std::string desc, OptionSwitch* const verbose)
38    : OptionSwitch(cmd, flag, desc, false), verbose_(verbose)
39  {
40  }
41
42
43  void OptionVersion::do_parse2(std::vector<std::string>::iterator first, 
44                                std::vector<std::string>::iterator last)
45  {
46    ColumnStream cs(std::cout, 1);
47    cs.width(0)=79;
48    cs << PACKAGE_NAME << " " << PACKAGE_VERSION;
49    bool no_verbose = verbose_ && verbose_->present() && !verbose_->value();
50    if (!no_verbose) {
51      cs << " (";
52      if (DEV_BUILD)
53        cs << "r" << svn_revision() << " ";
54      cs << "compiled " << compilation_time() << ", " << compilation_date() 
55         << ")";
56    } 
57    cs << "\n\nCopyright (C) " << svn_year() 
58       << " Jari H\u00E4kkinen and Peter Johansson.\n"
59       << "This is free software. You may redistribute copies of it under "
60       << "the terms of the GNU General Public License "
61       << "<http://www.gnu.org/licenses/gpl.html>.\n"
62       << "There is NO WARRANTY; to the extent permitted by law.\n";
63    exit(0);
64  }
65
66}} // of namespace svndigest and theplu
Note: See TracBrowser for help on using the repository browser.