source: trunk/lib/OptionVersion.cc @ 791

Last change on this file since 791 was 791, checked in by Peter Johansson, 12 years ago

added info on apr and svn in version output

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.5 KB
RevLine 
[705]1// $Id: OptionVersion.cc 791 2009-06-20 17:01:05Z peter $
2
3/*
[791]4  Copyright (C) 2008, 2009 Peter Johansson
[705]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
[726]24#include "copyright_year.h"
[705]25#include "OptionVersion.h"
26#include "ColumnStream.h"
27#include "CommandLine.h"
28#include "subversion_info.h"
29#include "utility.h"
30
[791]31#include <subversion-1/svn_version.h>
32
33#include <apr_version.h>
34
[705]35#include <sstream>
36#include <string>
37
38namespace theplu {
39namespace svndigest {
40
41  OptionVersion::OptionVersion(CommandLine& cmd, std::string flag, 
[724]42                               std::string desc, OptionSwitch* const verbose)
43    : OptionSwitch(cmd, flag, desc, false), verbose_(verbose)
[705]44  {
45  }
46
47
48  void OptionVersion::do_parse2(std::vector<std::string>::iterator first, 
49                                std::vector<std::string>::iterator last)
50  {
51    ColumnStream cs(std::cout, 1);
52    cs.width(0)=79;
[724]53    cs << PACKAGE_NAME << " " << PACKAGE_VERSION;
54    bool no_verbose = verbose_ && verbose_->present() && !verbose_->value();
55    if (!no_verbose) {
56      cs << " (";
57      if (DEV_BUILD)
[733]58        cs << svn_revision() << " ";
[724]59      cs << "compiled " << compilation_time() << ", " << compilation_date() 
60         << ")";
61    } 
62    cs << "\n\nCopyright (C) " << svn_year() 
[705]63       << " Jari H\u00E4kkinen and Peter Johansson.\n"
64       << "This is free software. You may redistribute copies of it under "
65       << "the terms of the GNU General Public License "
66       << "<http://www.gnu.org/licenses/gpl.html>.\n"
67       << "There is NO WARRANTY; to the extent permitted by law.\n";
[791]68    if (!no_verbose) {
69      cs << "\n"
70         << "Compiled with libsvn_subr " << SVN_VER_NUM
71         << "; using libsvn_subr ";
72      const svn_version_t* svn_ver = svn_subr_version();
73      cs << svn_ver->major << '.' << svn_ver->minor << '.' << svn_ver->patch;
74      cs << "\n"
75         << "Compiled with libapr " << APR_VERSION_STRING
76         << "; using libapr ";
77      cs << apr_version_string();
78      cs << "\n";
79    }
[705]80    exit(0);
81  }
82
83}} // of namespace svndigest and theplu
Note: See TracBrowser for help on using the repository browser.