bin/wa
#!/usr/bin/env node
var chalk = require("chalk"),
util = require("../cli/util"),
pkg = require("../package.json");
var cmd = process.argv[2];
process.argv.splice(2, 1);
switch (cmd) {
case "assembler":
case "assemble":
case "as":
case "a":
require("./wa-assemble");
break;
case "compiler":
case "compile":
case "comp":
case "c":
require("./wa-compile");
break;
case "disassembler":
case "disassemble":
case "dis":
case "d":
require("./wa-disassemble");
break;
case "linker":
case "link":
case "ln":
case "l":
require("./wa-link");
break;
case undefined:
util.printLogo("CLI");
process.stderr.write([
chalk.bold.white("Compiles, links, assembles and disassembles WebAssembly modules."),
"",
"For command specific usage instructions, type:",
"",
" wa compile " + chalk.gray.bold("or") + " wa-compile",
" wa link " + chalk.gray.bold("or") + " wa-link",
" wa assemble " + chalk.gray.bold("or") + " wa-assemble",
" wa disassemble " + chalk.gray.bold("or") + " wa-disassemble",
"",
"usage: " + chalk.bold.cyan("wa") + " <compile|link|assemble|disassemble> [options] file",
""
].join("\n"));
process.exit(1);
return 1;
default:
process.stderr.write(chalk.red.bold("FAILED") + " No such command: " + cmd + "\n");
process.exit(1);
return 2;
}