Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--longDescription is not mandatory #411

Merged
merged 5 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/metadata_constraints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const Metadata::ReservedMetadataTable reservedMetadataInfoTable = {

METADATA_ASSERT("LongDescription shouldn't be shorter than Description")
{
return !data.has("LongDescription")
|| data["LongDescription"].size() >= data["Description"].size();
return !data.has("LongDescription") ||
data["LongDescription"].size() == 0 ||
data["LongDescription"].size() >= data["Description"].size();
}
8 changes: 5 additions & 3 deletions src/zimwriterfs/zimwriterfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,12 @@
return false;

return creator.empty()
|| name.empty()
|| publisher.empty()
|| description.empty()
|| language.empty()
|| welcome.empty()
|| title.empty()
|| illustration.empty();
}

Expand Down Expand Up @@ -186,8 +188,6 @@
std::cout << "\t-t, --title\t\ttitle of the ZIM file" << std::endl;
std::cout << "\t-d, --description\tshort description of the content"
<< std::endl;
std::cout << "\t-L, --longDescription\tlong description of the content"
<< std::endl;
std::cout << "\t-c, --creator\t\tcreator(s) of the content" << std::endl;
std::cout << "\t-p, --publisher\t\tcreator of the ZIM file itself"
<< std::endl;
Expand All @@ -204,6 +204,8 @@
<< std::endl;
std::cout << "\t-h, --help\t\tprint this help" << std::endl;
std::cout << "\t-V, --version\t\tprint the version number" << std::endl;
std::cout << "\t-L, --longDescription\tlong description of the content"
<< std::endl;

Check warning on line 208 in src/zimwriterfs/zimwriterfs.cpp

View check run for this annotation

Codecov / codecov/patch

src/zimwriterfs/zimwriterfs.cpp#L207-L208

Added lines #L207 - L208 were not covered by tests
std::cout
<< "\t-m, --clusterSize\tnumber of bytes per ZIM cluster (default: 2048Kb)"
<< std::endl;
Expand Down Expand Up @@ -283,7 +285,7 @@

do {
c = getopt_long(
argc, argv, "ahVvijxuw:I:t:d:c:l:p:r:e:n:m:J:UBL:", long_options, &option_index);
argc, argv, "a:hVvijxuw:I:t:d:c:l:p:r:e:n:m:J:UBL:", long_options, &option_index);

if (c != -1) {
switch (c) {
Expand Down
Loading