summaryrefslogtreecommitdiff
path: root/cli/js/repl.ts
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2020-05-08 18:58:51 -0400
committerGitHub <noreply@github.com>2020-05-08 18:58:51 -0400
commit4e5e6da348fb6c6d289426f313e564d6fd6fe242 (patch)
treef80c0496de30c7927d578c6f900331fb14bf4bd4 /cli/js/repl.ts
parent9a0bf201c2d76364038f431dccfbf67922796382 (diff)
Add hint on how to exit REPL (#5143)
Removes exit and help commands
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