mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2025-09-07 22:29:05 -04:00
commit
e8b33a7136
@ -1,3 +1,8 @@
|
|||||||
|
kiwix-tools 3.0.2
|
||||||
|
=================
|
||||||
|
|
||||||
|
* New option --version for all tools
|
||||||
|
|
||||||
kiwix-tools 3.0.1
|
kiwix-tools 3.0.1
|
||||||
=================
|
=================
|
||||||
|
|
||||||
|
@ -161,4 +161,4 @@ License
|
|||||||
-------
|
-------
|
||||||
|
|
||||||
[GPLv3](https://www.gnu.org/licenses/gpl-3.0) or later, see
|
[GPLv3](https://www.gnu.org/licenses/gpl-3.0) or later, see
|
||||||
[LICENSE](LICENSE) for more details.
|
[COPYING](COPYING) for more details.
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
project('kiwix-tools', 'cpp',
|
project('kiwix-tools', 'cpp',
|
||||||
version : '3.0.1',
|
version : '3.0.2',
|
||||||
license : 'GPL',
|
license : 'GPL',
|
||||||
default_options: ['c_std=c11', 'cpp_std=c++11', 'werror=true'])
|
default_options: ['c_std=c11', 'cpp_std=c++11', 'werror=true'])
|
||||||
|
|
||||||
compiler = meson.get_compiler('cpp')
|
compiler = meson.get_compiler('cpp')
|
||||||
|
|
||||||
|
add_global_arguments('-DKIWIX_TOOLS_VERSION="@0@"'.format(meson.project_version()), language : 'cpp')
|
||||||
|
|
||||||
static_linkage = get_option('static-linkage')
|
static_linkage = get_option('static-linkage')
|
||||||
if static_linkage
|
if static_linkage
|
||||||
add_global_link_arguments('-static-libstdc++', '--static', language:'cpp')
|
add_global_link_arguments('-static-libstdc++', '--static', language:'cpp')
|
||||||
@ -24,5 +26,4 @@ if static_linkage
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#subdir('include')
|
|
||||||
subdir('src')
|
subdir('src')
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2011 Emmanuel Engelhart <kelson@kiwix.org>
|
* Copyright 2011-2019 Emmanuel Engelhart <kelson@kiwix.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -23,6 +23,8 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "../version.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
enum supportedAction { NONE, ADD, SHOW, REMOVE };
|
enum supportedAction { NONE, ADD, SHOW, REMOVE };
|
||||||
@ -78,6 +80,9 @@ void usage()
|
|||||||
<< "\t\t\t--zimPathToSave=CUSTOM_ZIM_PATH to replace the current ZIM file path" << std::endl
|
<< "\t\t\t--zimPathToSave=CUSTOM_ZIM_PATH to replace the current ZIM file path" << std::endl
|
||||||
<< "\t\t\t--url=HTTP_ZIM_URL to create an \"url\" attribute for the online version of the ZIM file" << std::endl
|
<< "\t\t\t--url=HTTP_ZIM_URL to create an \"url\" attribute for the online version of the ZIM file" << std::endl
|
||||||
<< std::endl
|
<< std::endl
|
||||||
|
<< "\t\t\tOther options:" << std::endl
|
||||||
|
<< "\t\t\t-v, --version to print the software version" << std::endl
|
||||||
|
<< std::endl
|
||||||
|
|
||||||
<< "Examples:" << std::endl
|
<< "Examples:" << std::endl
|
||||||
<< "\tAdd ZIM files to library: kiwix-manage my_library.xml add first.zim second.zim" << std::endl
|
<< "\tAdd ZIM files to library: kiwix-manage my_library.xml add first.zim second.zim" << std::endl
|
||||||
@ -144,11 +149,9 @@ int handle_add(kiwix::Library* library, const std::string& libraryPath,
|
|||||||
case 'u':
|
case 'u':
|
||||||
url = optarg;
|
url = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'o':
|
case 'o':
|
||||||
origID = optarg;
|
origID = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'z':
|
case 'z':
|
||||||
zimPathToSave = optarg;
|
zimPathToSave = optarg;
|
||||||
break;
|
break;
|
||||||
@ -217,7 +220,27 @@ int main(int argc, char** argv)
|
|||||||
supportedAction action = NONE;
|
supportedAction action = NONE;
|
||||||
kiwix::Library library;
|
kiwix::Library library;
|
||||||
|
|
||||||
/* Argument parsing */
|
/* General argument parsing */
|
||||||
|
static struct option long_options[] = {
|
||||||
|
{"version", no_argument, 0, 'v'},
|
||||||
|
{0, 0, 0, 0}
|
||||||
|
};
|
||||||
|
|
||||||
|
int option_index = 0;
|
||||||
|
int c;
|
||||||
|
while (true) {
|
||||||
|
c = getopt_long(argc, argv, "v", long_options, &option_index);
|
||||||
|
if (c == -1)
|
||||||
|
break;
|
||||||
|
|
||||||
|
switch (c) {
|
||||||
|
case 'v':
|
||||||
|
version();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Action related argument parsing */
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
libraryPath = argv[1];
|
libraryPath = argv[1];
|
||||||
string actionString = argv[2];
|
string actionString = argv[2];
|
||||||
|
@ -22,9 +22,11 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "../version.h"
|
||||||
|
|
||||||
void usage()
|
void usage()
|
||||||
{
|
{
|
||||||
cout << "Usage: kiwix-read --suggest=<PATTERN> ZIM_FILE_PATH" << endl;
|
cout << "Usage: kiwix-read [--verbose] [--version] --suggest=<PATTERN> ZIM_FILE_PATH" << endl;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,15 +44,19 @@ int main(int argc, char** argv)
|
|||||||
while (42) {
|
while (42) {
|
||||||
static struct option long_options[]
|
static struct option long_options[]
|
||||||
= {{"verbose", no_argument, 0, 'v'},
|
= {{"verbose", no_argument, 0, 'v'},
|
||||||
|
{"version", no_argument, 0, 'V'},
|
||||||
{"suggest", required_argument, 0, 's'},
|
{"suggest", required_argument, 0, 's'},
|
||||||
{0, 0, 0, 0}};
|
{0, 0, 0, 0}};
|
||||||
|
|
||||||
if (c != -1) {
|
if (c != -1) {
|
||||||
c = getopt_long(argc, argv, "vs:", long_options, &option_index);
|
c = getopt_long(argc, argv, "Vvs:", long_options, &option_index);
|
||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'v':
|
case 'v':
|
||||||
break;
|
break;
|
||||||
|
case 'V':
|
||||||
|
version();
|
||||||
|
return 0;
|
||||||
case 's':
|
case 's':
|
||||||
pattern = optarg;
|
pattern = optarg;
|
||||||
break;
|
break;
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <kiwix/reader.h>
|
#include <kiwix/reader.h>
|
||||||
#include <kiwix/searcher.h>
|
#include <kiwix/searcher.h>
|
||||||
|
|
||||||
|
#include "../version.h"
|
||||||
|
|
||||||
void usage()
|
void usage()
|
||||||
{
|
{
|
||||||
@ -29,7 +30,8 @@ void usage()
|
|||||||
<< " ZIM is the full path of the ZIM file." << endl
|
<< " ZIM is the full path of the ZIM file." << endl
|
||||||
<< " PATTERN is/are word(s) - or part of - to search in the ZIM." << endl << endl
|
<< " PATTERN is/are word(s) - or part of - to search in the ZIM." << endl << endl
|
||||||
<< " -s, --suggestion\tSuggest article titles based on the few letters of the PATTERN instead of making a fulltext search. Work a bit like a completion solution." << endl
|
<< " -s, --suggestion\tSuggest article titles based on the few letters of the PATTERN instead of making a fulltext search. Work a bit like a completion solution." << endl
|
||||||
<< " -v, --verbose\t\tGive details about the search process" << endl;
|
<< " -v, --verbose\t\tGive details about the search process" << endl
|
||||||
|
<< " -V, --version\t\tPrint software version" << endl;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,15 +56,19 @@ int main(int argc, char** argv)
|
|||||||
static struct option long_options[]
|
static struct option long_options[]
|
||||||
= {{"verbose", no_argument, 0, 'v'},
|
= {{"verbose", no_argument, 0, 'v'},
|
||||||
{"suggestion", no_argument, 0, 's'},
|
{"suggestion", no_argument, 0, 's'},
|
||||||
|
{"version", no_argument, 0, 'V'},
|
||||||
{0, 0, 0, 0}};
|
{0, 0, 0, 0}};
|
||||||
|
|
||||||
if (c != -1) {
|
if (c != -1) {
|
||||||
c = getopt_long(argc, argv, "vsb:", long_options, &option_index);
|
c = getopt_long(argc, argv, "Vvsb:", long_options, &option_index);
|
||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'v':
|
case 'v':
|
||||||
verboseFlag = true;
|
verboseFlag = true;
|
||||||
break;
|
break;
|
||||||
|
case 'V':
|
||||||
|
version();
|
||||||
|
return 0;
|
||||||
case 's':
|
case 's':
|
||||||
suggestionFlag = true;
|
suggestionFlag = true;
|
||||||
break;
|
break;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009-2016 Emmanuel Engelhart <kelson@kiwix.org>
|
* Copyright 2009-2019 Emmanuel Engelhart <kelson@kiwix.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -33,6 +33,8 @@
|
|||||||
# define MIBSIZE 4
|
# define MIBSIZE 4
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "../version.h"
|
||||||
|
|
||||||
#define DEFAULT_THREADS 4
|
#define DEFAULT_THREADS 4
|
||||||
|
|
||||||
void usage()
|
void usage()
|
||||||
@ -62,6 +64,7 @@ void usage()
|
|||||||
<< "\t-r, --urlRootLocation\tURL prefix on which the content should be made available (default: /)" << std::endl
|
<< "\t-r, --urlRootLocation\tURL prefix on which the content should be made available (default: /)" << std::endl
|
||||||
<< "\t-t, --threads\t\tnumber of threads to run in parallel (default: " << DEFAULT_THREADS << ")" << std::endl
|
<< "\t-t, --threads\t\tnumber of threads to run in parallel (default: " << DEFAULT_THREADS << ")" << std::endl
|
||||||
<< "\t-v, --verbose\t\tprint debug log to STDOUT" << std::endl
|
<< "\t-v, --verbose\t\tprint debug log to STDOUT" << std::endl
|
||||||
|
<< "\t-V, --version\t\tprint software version" << std::endl
|
||||||
<< "\t-z, --nodatealiases\tcreate URL aliases for each content by removing the date" << std::endl
|
<< "\t-z, --nodatealiases\tcreate URL aliases for each content by removing the date" << std::endl
|
||||||
<< std::endl
|
<< std::endl
|
||||||
|
|
||||||
@ -93,6 +96,7 @@ int main(int argc, char** argv)
|
|||||||
static struct option long_options[]
|
static struct option long_options[]
|
||||||
= {{"daemon", no_argument, 0, 'd'},
|
= {{"daemon", no_argument, 0, 'd'},
|
||||||
{"verbose", no_argument, 0, 'v'},
|
{"verbose", no_argument, 0, 'v'},
|
||||||
|
{"version", no_argument, 0, 'V'},
|
||||||
{"library", no_argument, 0, 'l'},
|
{"library", no_argument, 0, 'l'},
|
||||||
{"nolibrarybutton", no_argument, 0, 'm'},
|
{"nolibrarybutton", no_argument, 0, 'm'},
|
||||||
{"nodatealiases", no_argument, 0, 'z'},
|
{"nodatealiases", no_argument, 0, 'z'},
|
||||||
@ -108,7 +112,7 @@ int main(int argc, char** argv)
|
|||||||
while (true) {
|
while (true) {
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
int c
|
int c
|
||||||
= getopt_long(argc, argv, "mndvla:p:f:t:r:", long_options, &option_index);
|
= getopt_long(argc, argv, "mndvVla:p:f:t:r:", long_options, &option_index);
|
||||||
|
|
||||||
if (c != -1) {
|
if (c != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
@ -118,6 +122,9 @@ int main(int argc, char** argv)
|
|||||||
case 'v':
|
case 'v':
|
||||||
isVerboseFlag = true;
|
isVerboseFlag = true;
|
||||||
break;
|
break;
|
||||||
|
case 'V':
|
||||||
|
version();
|
||||||
|
return 0;
|
||||||
case 'l':
|
case 'l':
|
||||||
libraryFlag = true;
|
libraryFlag = true;
|
||||||
break;
|
break;
|
||||||
|
32
src/version.h
Normal file
32
src/version.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009-2016 Emmanuel Engelhart <kelson@kiwix.org>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _KIWIX_TOOLS_VERSION_H_
|
||||||
|
#define _KIWIX_TOOLS_VERSION_H_
|
||||||
|
|
||||||
|
#ifndef KIWIX_TOOLS_VERSION
|
||||||
|
#define KIWIX_TOOLS_VERSION "undefined"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void version()
|
||||||
|
{
|
||||||
|
std::cout << KIWIX_TOOLS_VERSION << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //_KIWIX_TOOLs_VERSION_H_
|
Loading…
x
Reference in New Issue
Block a user