-
-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Description
I love .tree() because it can represent nested dependencies:
omelette('hello').tree({
cruel: ['world', 'moon'],
beautiful: ['mars', 'pluto']
}).init();However, it’d be great if it were possible to also dynamically create the top level via a callback:
omelette('hello').tree(
async () => {
const json = await /* ... */;
return json;
}
).init();In my own code, I use the following workaround (TypeScript code):
const oml = omelette(BIN_NAME) as omelette.Instance & { compgen: number };
if (oml.compgen >= 0) {
const tree: omelette.TreeValue = {};
const projectDir = process.cwd();
if (BookConfig.isProjectDir(projectDir)) {
const bookConfig = BookConfig.fromDir(projectDir);
for (const key of bookConfig.getOutputConfigKeys()) {
tree[key] = ['--dry-run', '--replace'];
}
}
oml.tree(tree).init();
return; // not really needed
}Metadata
Metadata
Assignees
Labels
No labels