From 184be99f5b6e85a6041e72dfdd0afda46e5f8619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 4 Feb 2020 20:24:33 +0100 Subject: refactor: CLI subcommands and argv (#3886) --- cli/js/runtime.ts | 11 +++++------ cli/js/runtime_main.ts | 7 +++---- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'cli/js') diff --git a/cli/js/runtime.ts b/cli/js/runtime.ts index 8cebf5dca..53ce5fcee 100644 --- a/cli/js/runtime.ts +++ b/cli/js/runtime.ts @@ -13,8 +13,9 @@ import { setPrepareStackTrace } from "./error_stack.ts"; interface Start { cwd: string; pid: number; - argv: string[]; - mainModule: string; // Absolute URL. + args: string[]; + location: string; // Absolute URL. + repl: boolean; debugFlag: boolean; depsFlag: boolean; typesFlag: boolean; @@ -57,10 +58,8 @@ export function start(preserveDenoNamespace = true, source?: string): Start { util.setLogDebug(s.debugFlag, source); // TODO(bartlomieju): this field should always be set - if (s.mainModule) { - assert(s.mainModule.length > 0); - setLocation(s.mainModule); - } + assert(s.location.length > 0); + setLocation(s.location); setPrepareStackTrace(Error); // TODO(bartlomieju): I don't like that it's mixed in here, when diff --git a/cli/js/runtime_main.ts b/cli/js/runtime_main.ts index 2ede2e20f..b5517cbcb 100644 --- a/cli/js/runtime_main.ts +++ b/cli/js/runtime_main.ts @@ -72,14 +72,13 @@ export function bootstrapMainRuntime(): void { setSignals(); log("cwd", s.cwd); - for (let i = 0; i < s.argv.length; i++) { - args.push(s.argv[i]); + for (let i = 0; i < s.args.length; i++) { + args.push(s.args[i]); } log("args", args); Object.freeze(args); - // TODO(bartlomieju): rename to s.repl - if (!s.mainModule) { + if (s.repl) { replLoop(); } } -- cgit v1.2.3