mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2025-09-22 11:22:38 -04:00
[manage] Do not show all books if id has been provided on command line.
Fix #240.
This commit is contained in:
parent
d57a37cde6
commit
c5b293c6f3
@ -1,4 +1,4 @@
|
|||||||
kiwix-tools 1.2.0
|
kiwix-tools 1.1.1
|
||||||
=================
|
=================
|
||||||
|
|
||||||
kiwix-serve
|
kiwix-serve
|
||||||
@ -6,6 +6,11 @@ kiwix-serve
|
|||||||
|
|
||||||
* New Dockerfile of kiwix-serve
|
* New Dockerfile of kiwix-serve
|
||||||
|
|
||||||
|
kiwix-manage
|
||||||
|
------------
|
||||||
|
|
||||||
|
* Do not show all books if book ids has been provided.
|
||||||
|
|
||||||
kiwix-tools 1.1.0
|
kiwix-tools 1.1.0
|
||||||
=================
|
=================
|
||||||
|
|
||||||
|
@ -35,14 +35,11 @@ using namespace std;
|
|||||||
|
|
||||||
enum supportedAction { NONE, ADD, SHOW, REMOVE, DOWNLOAD };
|
enum supportedAction { NONE, ADD, SHOW, REMOVE, DOWNLOAD };
|
||||||
|
|
||||||
void show(kiwix::Library* library)
|
void show(kiwix::Library* library, const std::string& bookId)
|
||||||
{
|
{
|
||||||
auto booksIds = library->getBooksIds();
|
try {
|
||||||
unsigned int inc = 1;
|
auto& book = library->getBookById(bookId);
|
||||||
for(auto& id: booksIds) {
|
std::cout << "id:\t\t" << book.getId() << std::endl
|
||||||
auto& book = library->getBookById(id);
|
|
||||||
std::cout << "#" << inc++ << std::endl
|
|
||||||
<< "id:\t\t" << book.getId() << std::endl
|
|
||||||
<< "path:\t\t" << book.getPath() << std::endl
|
<< "path:\t\t" << book.getPath() << std::endl
|
||||||
<< "url:\t\t" << book.getUrl() << std::endl
|
<< "url:\t\t" << book.getUrl() << std::endl
|
||||||
<< "title:\t\t" << book.getTitle() << std::endl
|
<< "title:\t\t" << book.getTitle() << std::endl
|
||||||
@ -53,9 +50,11 @@ void show(kiwix::Library* library)
|
|||||||
<< "date:\t\t" << book.getDate() << std::endl
|
<< "date:\t\t" << book.getDate() << std::endl
|
||||||
<< "articleCount:\t" << book.getArticleCount() << std::endl
|
<< "articleCount:\t" << book.getArticleCount() << std::endl
|
||||||
<< "mediaCount:\t" << book.getMediaCount() << std::endl
|
<< "mediaCount:\t" << book.getMediaCount() << std::endl
|
||||||
<< "size:\t\t" << book.getSize() << " KB" << std::endl
|
<< "size:\t\t" << book.getSize() << " KB" << std::endl;
|
||||||
<< std::endl;
|
} catch (std::out_of_range&) {
|
||||||
|
std::cout << "No book " << bookId << " in the library" << std::endl;
|
||||||
}
|
}
|
||||||
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void usage()
|
void usage()
|
||||||
@ -75,7 +74,17 @@ void usage()
|
|||||||
bool handle_show(kiwix::Library* library, const std::string& libraryPath,
|
bool handle_show(kiwix::Library* library, const std::string& libraryPath,
|
||||||
int argc, char* argv[])
|
int argc, char* argv[])
|
||||||
{
|
{
|
||||||
show(library);
|
if (argc > 3 ) {
|
||||||
|
for(auto i=3; i<argc; i++) {
|
||||||
|
std::string bookId = argv[i];
|
||||||
|
show(library, bookId);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
auto booksIds = library->getBooksIds();
|
||||||
|
for(auto& bookId: booksIds) {
|
||||||
|
show(library, bookId);
|
||||||
|
}
|
||||||
|
}
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user