summaryrefslogtreecommitdiff
path: root/cli/js/repl.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/js/repl.ts')
-rw-r--r--cli/js/repl.ts25
1 files changed, 4 insertions, 21 deletions
diff --git a/cli/js/repl.ts b/cli/js/repl.ts
index 044713678..138b30c3e 100644
--- a/cli/js/repl.ts
+++ b/cli/js/repl.ts
@@ -1,6 +1,7 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { exit } from "./ops/os.ts";
import { core } from "./core.ts";
+import { version } from "./version.ts";
import { stringifyArgs } from "./web/console.ts";
import { startRepl, readline } from "./ops/repl.ts";
import { close } from "./ops/resources.ts";
@@ -13,26 +14,6 @@ function replError(...args: unknown[]): void {
core.print(stringifyArgs(args) + "\n", true);
}
-const helpMsg = [
- "_ Get last evaluation result",
- "_error Get last thrown error",
- "exit Exit the REPL",
- "help Print this help message",
-].join("\n");
-
-const replCommands = {
- exit: {
- get(): void {
- exit(0);
- },
- },
- help: {
- get(): string {
- return helpMsg;
- },
- },
-};
-
// Error messages that allow users to continue input
// instead of throwing an error to REPL
// ref: https://github.com/v8/v8/blob/master/src/message-template.h
@@ -83,7 +64,6 @@ function evaluate(code: string): boolean {
// @internal
export async function replLoop(): Promise<void> {
const { console } = globalThis;
- Object.defineProperties(globalThis, replCommands);
const historyFile = "deno_history.txt";
const rid = startRepl(historyFile);
@@ -126,6 +106,9 @@ export async function replLoop(): Promise<void> {
},
});
+ replLog(`Deno ${version.deno}`);
+ replLog("exit using ctrl+d or close()");
+
while (true) {
let code = "";
// Top level read