Skip to content

Commit

Permalink
feat: adds --source parameter to CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
Marvin1003 committed Sep 14, 2019
1 parent 2207666 commit 359032b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bin/compileCLI.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ const cliOptions = [
{ name: "module", alias: "m", type: Boolean },
{ name: "output", alias: "o", type: String },
{ name: "input", alias: "i", type: String },
{ name: "spawn", type: Boolean}
{ name: "spawn", type: Boolean },
{ name: "source", type: String }
];
const args = cliParser(cliOptions);
if (!("standalone" in args)) args.standalone = false;
if (!("module" in args)) args.module = false;
if (!("output" in args)) args.output = null;
if (!("input" in args)) args.input = null;
if (!("spawn" in args)) args.spawn = false;
if (!("source" in args)) args.source = null;
function inputSource(input, callback) {
fs.readFile(input, function (error, buffer) {
if (error) throw error;
Expand Down Expand Up @@ -51,6 +53,8 @@ function compile(source) {
if (args.input !== null) {
if (args.output !== null) console.log("Opening " + args.input + " for compilation.");
inputSource(args.input, compile);
} else if(args.source) {
compile(args.source);
} else {
stdInSource(compile);
}

0 comments on commit 359032b

Please sign in to comment.