mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-19 05:07:56 +00:00
Improve output from "rhizome extract manifest"
This commit is contained in:
parent
01e81200d0
commit
e230bbc40b
@ -899,8 +899,6 @@ int rhizome_retrieve_manifest(const char *manifestid, rhizome_manifest **mp)
|
||||
ret = WHY("Manifest is missing filesize line");
|
||||
else
|
||||
m->fileLength = lengthq;
|
||||
}
|
||||
}
|
||||
if (ret == 1) {
|
||||
cli_puts("manifestid"); cli_delim(":");
|
||||
cli_puts((const char *)sqlite3_column_text(statement, 0)); cli_delim("\n");
|
||||
@ -908,9 +906,15 @@ int rhizome_retrieve_manifest(const char *manifestid, rhizome_manifest **mp)
|
||||
cli_printf("%lld", (long long) sqlite3_column_int64(statement, 2)); cli_delim("\n");
|
||||
cli_puts("inserttime"); cli_delim(":");
|
||||
cli_printf("%lld", (long long) sqlite3_column_int64(statement, 3)); cli_delim("\n");
|
||||
cli_puts("filehash"); cli_delim(":");
|
||||
cli_puts(m->fileHexHash); cli_delim("\n");
|
||||
cli_puts("filesize"); cli_delim(":");
|
||||
cli_printf("%lld", (long long) m->fileLength); cli_delim("\n");
|
||||
// Could write the manifest blob to the CLI output here, but that would require the output to
|
||||
// support byte[] fields as well as String fields.
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -969,7 +973,7 @@ int rhizome_retrieve_file(const char *fileid, const char *filepath)
|
||||
ret = 1;
|
||||
cli_puts("filehash"); cli_delim(":");
|
||||
cli_puts((const char *)sqlite3_column_text(statement, 0)); cli_delim("\n");
|
||||
cli_puts("length"); cli_delim(":");
|
||||
cli_puts("filesize"); cli_delim(":");
|
||||
cli_printf("%lld", length); cli_delim("\n");
|
||||
}
|
||||
}
|
||||
|
@ -179,14 +179,18 @@ setup_AddThenExtractManifest() {
|
||||
assert_rhizome_list file1
|
||||
extract_manifest_id manifestid file1.manifest
|
||||
extract_manifest_version version file1.manifest
|
||||
extract_manifest_filehash filehash file1.manifest
|
||||
}
|
||||
test_AddThenExtractManifest() {
|
||||
executeOk $dna rhizome extract manifest $manifestid file1x.manifest
|
||||
assert cmp file1.manifest file1x.manifest
|
||||
assertStdoutLineCount '==' 3
|
||||
assertStdoutLineCount '==' 5
|
||||
local size=$(( $(cat file1 | wc -c) + 0 ))
|
||||
assertStdoutGrep --matches=1 "^manifestid:$manifestid$"
|
||||
assertStdoutGrep --matches=1 "^version:$version$"
|
||||
assertStdoutGrep --matches=1 "^inserttime:[0-9]\+$"
|
||||
assertStdoutGrep --matches=1 "^filehash:$filehash$"
|
||||
assertStdoutGrep --matches=1 "^filesize:$size$"
|
||||
}
|
||||
|
||||
doc_ExtractMissingManifest="Extract non-existent manifest"
|
||||
@ -230,7 +234,7 @@ test_AddThenExtractFile() {
|
||||
local size=$(( $(cat file1 | wc -c) + 0 ))
|
||||
assertStdoutLineCount '==' 2
|
||||
assertStdoutGrep --matches=1 "^filehash:$filehash$"
|
||||
assertStdoutGrep --matches=1 "^length:$size$"
|
||||
assertStdoutGrep --matches=1 "^filesize:$size$"
|
||||
}
|
||||
|
||||
doc_ExtractMissingFile="Extract non-existent file"
|
||||
|
Loading…
Reference in New Issue
Block a user