Add "targets" command
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
|
||||
import yargs from "yargs";
|
||||
import { hideBin } from "yargs/helpers";
|
||||
import startCompile, { Target } from "./process";
|
||||
import startCompile, { Target, Targets } from "./process";
|
||||
|
||||
import dbg from "debug";
|
||||
const log = dbg("app");
|
||||
@ -54,6 +54,12 @@ yargs(hideBin(process.argv))
|
||||
})
|
||||
}
|
||||
)
|
||||
.command("targets", "List all targets", (yargs)=>yargs, ()=>{
|
||||
console.log("Targets:")
|
||||
Targets.forEach((__dirname, target) => {
|
||||
console.log(" " + target);
|
||||
})
|
||||
})
|
||||
.option("verbose", {
|
||||
alias: "v",
|
||||
type: "boolean",
|
||||
|
@ -16,12 +16,13 @@ class CatchedError extends Error {}
|
||||
|
||||
const log = dbg("app");
|
||||
|
||||
const Targets = new Map<string, typeof CompileTarget>();
|
||||
export const Targets = new Map<string, typeof CompileTarget>();
|
||||
|
||||
Targets.set("ts-esm", ESMTypescriptTarget);
|
||||
Targets.set("ts-node", NodeJSTypescriptTarget);
|
||||
Targets.set("c#", CSharpTarget as typeof CompileTarget);
|
||||
|
||||
|
||||
function indexToLineAndCol(src: string, index: number) {
|
||||
let line = 1;
|
||||
let col = 1;
|
||||
|
Reference in New Issue
Block a user