ceddcozum 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +14 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -27170,7 +27170,7 @@ var HIDDEN_TOOL_IDS = [
|
|
|
27170
27170
|
"gfr",
|
|
27171
27171
|
"leptin-sds"
|
|
27172
27172
|
];
|
|
27173
|
-
var VERSION = "0.1.
|
|
27173
|
+
var VERSION = "0.1.2";
|
|
27174
27174
|
var visibleSchemas = toolSchemas.filter(
|
|
27175
27175
|
(s) => !HIDDEN_TOOL_IDS.includes(s.function.name)
|
|
27176
27176
|
);
|
|
@@ -27265,6 +27265,11 @@ ${bold2("ceddcozum")} \u2014 ${cyan2(String(visibleSchemas.length))} tools avail
|
|
|
27265
27265
|
}
|
|
27266
27266
|
console.log();
|
|
27267
27267
|
}
|
|
27268
|
+
console.log(dim2(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
27269
|
+
console.log(` ${dim2("Run")} ${cyan2("ceddcozum <tool>")} ${dim2("to see parameters")}`);
|
|
27270
|
+
console.log(` ${dim2("Run")} ${cyan2("ceddcozum <tool> key=value ...")} ${dim2("to calculate")}`);
|
|
27271
|
+
console.log(` ${dim2("Example:")} ${cyan2("ceddcozum auxology sex=male age=5.5 height=110 weight=19")}`);
|
|
27272
|
+
console.log();
|
|
27268
27273
|
}
|
|
27269
27274
|
function extractUnit(description) {
|
|
27270
27275
|
const match = description.match(/\bin\s+((?:[\w/°µ²]+(?:\s+per\s+\w+)?))/i);
|
|
@@ -27355,8 +27360,9 @@ function parseKeyValueArgs(pairs, schema) {
|
|
|
27355
27360
|
console.error(` Use ${cyan2("key=value")} format, e.g. ${dim2("sex=male age=5.5")}`);
|
|
27356
27361
|
process.exit(1);
|
|
27357
27362
|
}
|
|
27358
|
-
const
|
|
27363
|
+
const rawKey = pair.slice(0, eqIdx);
|
|
27359
27364
|
const raw = pair.slice(eqIdx + 1);
|
|
27365
|
+
const key = Object.keys(props).find((k) => k.toLowerCase() === rawKey.toLowerCase()) ?? rawKey;
|
|
27360
27366
|
const prop = props[key];
|
|
27361
27367
|
if (prop?.type === "number") {
|
|
27362
27368
|
const n = Number(raw);
|
|
@@ -27368,7 +27374,12 @@ function parseKeyValueArgs(pairs, schema) {
|
|
|
27368
27374
|
} else if (prop?.type === "boolean") {
|
|
27369
27375
|
args[key] = raw === "true" || raw === "1";
|
|
27370
27376
|
} else {
|
|
27371
|
-
|
|
27377
|
+
if (prop?.enum) {
|
|
27378
|
+
const match = prop.enum.find((e) => e.toLowerCase() === raw.toLowerCase());
|
|
27379
|
+
args[key] = match ?? raw;
|
|
27380
|
+
} else {
|
|
27381
|
+
args[key] = raw;
|
|
27382
|
+
}
|
|
27372
27383
|
}
|
|
27373
27384
|
}
|
|
27374
27385
|
return args;
|