Repository navigation
bring importers into line, and improve documentation - #465
Conversation
jmandel
left a comment
There was a problem hiding this comment.
Looks good to me. I ran the branch locally: -v/--version, the earlier names, the missing-version error, the refusal of an existing destination with no terminal (file left untouched), and -y all behave as documented, and the overwrite note in the readme matches what TerminologyBuilder does.
One thing that does not work yet: --verbose never prints the stack trace.
$ tx-import loinc-v2 import -s ./empty -d ./new.db -v 2.83 --verbose
✗ loinc-v2 import failed: required LOINC file missing: ./empty/LoincTable/Loinc.csv
Same output with tx-import --verbose loinc-v2 import .... I think the program-level --verbose in tx-import.js takes the flag, so the import command's o.verbose stays undefined. The unit test passes because it calls the action with { verbose: true } directly. Reading the flag with optsWithGlobals() in importAction (or dropping the per-command --verbose and reading the program's) should fix it. Not blocking.
The Security Scan failure is the tar advisories, not this change.
|
Follow-up on With commander 14, the program-level --- a/tx/importers/sqlite-v2/cli-options.js
+++ b/tx/importers/sqlite-v2/cli-options.js
@@ function importAction(module, fn) {
- return async (o) => {
+ return async (o, cmd) => {
try {
await fn(o);
} catch (error) {
module.logError(`${module.getName()} import failed: ${error.message}`);
- if (o.verbose) {
+ if (o.verbose || (cmd && cmd.optsWithGlobals().verbose)) {
console.error(error.stack);
} |
@jmandel: notes about documentation
TerminologyBuilderdeletes an existing destination as soon as the import starts. The docs now say so, and suggest importing to a new name if the old file is in use.--sourceand--destare still required, and nothing is remembered between runs.loinc-v2has no--languages. Add LOINC language selection and fix import CLI options #445's language selection only applies to the classic LOINC importer.