-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
39 lines (32 loc) · 1.02 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"use strict";
const path = require("path");
const isLocal = typeof process.pkg === "undefined";
const basePath = isLocal ? process.cwd() : path.dirname(process.execPath);
const fs = require("fs");
const { Command } = require("commander");
const program = new Command();
const chalk = require("chalk");
const { startCreating, buildSetup } = require(path.join(
basePath,
"/src/main.js"
));
program
.name("generate")
.option("-c, --continue <dna>", "Continues generatino using a _dna.json file")
.action((options) => {
console.log(chalk.green("genator started"), options.continue);
options.continue
? console.log(
chalk.bgCyanBright("\n continuing generation using _dna.json file \n")
)
: null;
buildSetup();
let dna = null;
if (options.continue) {
const storedGenomes = JSON.parse(fs.readFileSync(options.continue));
dna = new Set(storedGenomes);
console.log({ dna });
}
startCreating(dna);
});
program.parse();