Index Visio files using vsd2xhtml
[xapian.git] / xapian-applications / omega / commonhelp.cc
blob7e17441aba34e91aabaf42099d9f754cf835a8f8
1 /* commonhelp.cc: handle command line help common to omindex and scriptindex
3 * Copyright (C) 2005,2006,2008,2009,2010,2013 Olly Betts
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
18 * USA
21 #include <config.h>
23 #include "commonhelp.h"
25 #include <xapian.h>
27 #include <cstring>
28 #include <iostream>
29 #include <string>
31 using namespace std;
33 void print_package_info(const char *name) {
34 cout << name << " - " PACKAGE_STRING << endl;
37 void print_stemmer_help(const char * spaces) {
38 cout << " -s, --stemmer=LANG " << spaces << "set the stemming language (default: english).\n";
39 string wrap = "Possible values: " + Xapian::Stem::get_available_languages();
40 wrap += " (pass 'none' to disable stemming)";
41 const size_t WRAP_AT = 79 - 22 - strlen(spaces);
42 while (wrap.size() > WRAP_AT) {
43 size_t i;
44 for (i = WRAP_AT; i > 0 && wrap[i] != ' '; --i) { }
45 if (i == 0) break;
46 cout << string(22, ' ') << spaces << wrap.substr(0, i) << "\n";
47 wrap.erase(0, i + 1);
49 cout << string(22, ' ') << spaces << wrap << endl;
52 void print_help_and_version_help(const char * spaces) {
53 cout << " -h, --help " << spaces << "display this help and exit\n"
54 " -V, --version " << spaces << "output version information and exit\n"
55 "\n"
56 "Please report bugs at:\n"
57 PACKAGE_BUGREPORT << endl;