]>
git.proxmox.com Git - ceph.git/blob - ceph/src/librados-config.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License version 2, as published by the Free Software
11 * Foundation. See file COPYING.
16 #include <boost/program_options/cmdline.hpp>
17 #include <boost/program_options/option.hpp>
18 #include <boost/program_options/options_description.hpp>
19 #include <boost/program_options/parsers.hpp>
20 #include <boost/program_options/variables_map.hpp>
22 #include "include/rados/librados.h"
25 namespace po
= boost::program_options
;
27 int main(int argc
, const char **argv
)
29 po::options_description desc
{"usage: librados-config [option]"};
31 ("help,h", "print this help message")
32 ("version", "library version")
33 ("vernum", "library version code")
34 ("release", "print release name");
36 po::parsed_options parsed
=
37 po::command_line_parser(argc
, argv
).options(desc
).run();
39 po::store(parsed
, vm
);
42 if (vm
.count("help")) {
43 std::cout
<< desc
<< std::endl
;
44 } else if (vm
.count("version")) {
46 rados_version(&maj
, &min
, &ext
);
47 std::cout
<< maj
<< "." << min
<< "." << ext
<< std::endl
;
48 } else if (vm
.count("vernum")) {
49 std::cout
<< std::hex
<< LIBRADOS_VERSION_CODE
<< std::dec
<< std::endl
;
50 } else if (vm
.count("release")) {
51 std::cout
<< CEPH_RELEASE_NAME
<< ' '
52 << '(' << CEPH_RELEASE_TYPE
<< ')'
55 std::cerr
<< argv
[0] << ": -h or --help for usage" << std::endl
;