added version/help page
This commit is contained in:
parent
d26dbc7734
commit
e7a8dd9af4
3 changed files with 24 additions and 2 deletions
|
@ -24,6 +24,7 @@
|
|||
};
|
||||
|
||||
outputs = flakes: let
|
||||
version = "1.3.0";
|
||||
self = flakes.self.packages.x86_64-linux;
|
||||
nixpkgs = flakes.nixpkgs.legacyPackages.x86_64-linux.pkgsStatic;
|
||||
nixpkgs-dyn = flakes.nixpkgs.legacyPackages.x86_64-linux;
|
||||
|
@ -120,6 +121,7 @@
|
|||
${cxx} \
|
||||
-o $out/bin/knock \
|
||||
${./src/knock.cpp} \
|
||||
-D KNOCK_VERSION='"${version}"' \
|
||||
-Wl,--as-needed -static \
|
||||
${self.utils-common}/lib/libutils-common.a \
|
||||
${self.gourou}/lib/libgourou.a \
|
||||
|
|
|
@ -3,12 +3,26 @@
|
|||
#include "libgourou_common.h"
|
||||
#include "libgourou.h"
|
||||
|
||||
#ifndef KNOCK_VERSION
|
||||
#error KNOCK_VERSION must be defined
|
||||
#endif
|
||||
|
||||
std::string get_data_dir();
|
||||
void verify_absence(std::string file);
|
||||
void verify_presence(std::string file);
|
||||
|
||||
int main(int argc, char** argv) try {
|
||||
|
||||
if (argc == 1) {
|
||||
std::cout
|
||||
<< "info: knock version " << KNOCK_VERSION << ", libgourou version "
|
||||
<< LIBGOUROU_VERSION << "\n"
|
||||
<< "usage: " << argv[0] << " [ACSM]" << "\n"
|
||||
<< "result: converts file ACSM to a plain EPUB/PDF if present, otherwise prints this"
|
||||
<< std::endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
if (argc != 2) {
|
||||
throw std::invalid_argument("the ACSM file must be passed as an argument");
|
||||
}
|
||||
|
|
|
@ -19,8 +19,14 @@ if len(sys.argv) != 2:
|
|||
sys.exit()
|
||||
|
||||
print("Testing " + str(knock))
|
||||
workspace = Path(sys.argv[1])
|
||||
|
||||
result = subprocess.run(knock)
|
||||
if result.returncode != 0:
|
||||
print("Test failed: knock failed to describe itself")
|
||||
sys.exit()
|
||||
print("---")
|
||||
|
||||
workspace = Path(sys.argv[1])
|
||||
if workspace.exists():
|
||||
shutil.rmtree(workspace)
|
||||
workspace.mkdir()
|
||||
|
@ -50,7 +56,7 @@ for i, link in enumerate(links):
|
|||
result = subprocess.run([knock, file])
|
||||
|
||||
if result.returncode != 0:
|
||||
print("Failed")
|
||||
print("Test failed: knock failed to convert a file")
|
||||
sys.exit()
|
||||
|
||||
print("Success\n---")
|
||||
|
|
Loading…
Reference in a new issue