3 Commits
0.7.0 ... 0.8.0

Author SHA1 Message Date
Matthieu Gautier
38088ee321 New version 0.8.0 2018-11-12 16:52:29 +01:00
Matthieu Gautier
0f445e9791 Merge pull request #238 from kiwix/remove_several_id
Be able to remove several books in a single command.
2018-11-12 14:38:28 +01:00
Matthieu Gautier
1032a46c57 Be able to remove several books in a single command.
Fix #236
2018-11-12 14:00:45 +01:00
3 changed files with 23 additions and 12 deletions

View File

@@ -1,3 +1,11 @@
kiwix-tools 0.8.0
=================
kiwix-manage
------------
* Be able to remove several books from the library in one command.
kiwix-tools 0.7.0
=================

View File

@@ -1,5 +1,5 @@
project('kiwix-tools', 'cpp',
version : '0.7.0',
version : '0.8.0',
license : 'GPL',
default_options: ['c_std=c11', 'cpp_std=c++11', 'werror=true'])

View File

@@ -165,19 +165,22 @@ bool handle_remove(kiwix::Library* library, const std::string& libraryPath,
const unsigned int totalBookCount = library->getBookCount(true, true);
bool exitCode = 0;
if (argc > 3) {
bookId = argv[3];
if (argc <= 3) {
std::cerr << "BookId to remove missing in the command line" << std::endl;
return (-1);
}
if (!library->removeBookById(bookId)) {
if (totalBookCount > 0) {
std::cerr
<< "Invalid book id." << std::endl;
exitCode = 1;
} else {
std::cerr
<< "Invalid book id. Library is empty, no book to delete."
<< std::endl;
if (!totalBookCount) {
std::cerr << "Library is empty, no book to delete."
<< std::endl;
return 1;
}
for (int i = 3; i<argc; i++) {
bookId = argv[i];
if (!library->removeBookById(bookId)) {
std::cerr << "Invalid book id '" << bookId << "'." << std::endl;
exitCode = 1;
}
}