diff --git a/notebooks/tests/animate.ipynb b/notebooks/tests/animate.ipynb index 30c76d694b88735d76eda60ce4e85b5712bfb1c7..bc367a0d81e4b599bebaf9c3ef2f47b64e10216c 100644 --- a/notebooks/tests/animate.ipynb +++ b/notebooks/tests/animate.ipynb @@ -98,14 +98,12 @@ "data": { "text/markdown": [ "```\n", - ":initialise [PREDICATE]\n", ":init [PREDICATE]\n", "```\n", "\n", "Initialise the current machine with the specified predicate" ], "text/plain": [ - ":initialise [PREDICATE]\n", ":init [PREDICATE]\n", "\n", "Initialise the current machine with the specified predicate" diff --git a/notebooks/tests/help.ipynb b/notebooks/tests/help.ipynb index 60ae957c4293beceb9f94deb5deeef70f9ad0eea..d601de4515851122069ccad1bf066999421edabb 100644 --- a/notebooks/tests/help.ipynb +++ b/notebooks/tests/help.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "`:help` can be used to list all commands, or get help for a specific command. `:?` is equivalent to `:help`." + "`:help` can be used to list all commands, or get help for a specific command." ] }, { @@ -19,7 +19,7 @@ "\n", "* `::load` Load the machine source code from the body.\n", "* `::render` Render some content with the specified MIME type.\n", - "* `:?` Display help for a specific command, or general help about the REPL.\n", + "* `:assert` Ensure that the predicate is true, and show an error otherwise.\n", "* `:browse` Show information about the current state\n", "* `:constants` Set up the current machine's constants with the specified predicate\n", "* `:eval` Evaluate an expression.\n", @@ -27,20 +27,20 @@ "* `:groovy` Evaluate the given Groovy expression.\n", "* `:help` Display help for a specific command, or general help about the REPL.\n", "* `:init` Initialise the current machine with the specified predicate\n", - "* `:initialise` Initialise the current machine with the specified predicate\n", "* `:load` Load the machine from the given path.\n", "* `:pref` View or change the value of one or more preferences.\n", "* `:prettyprint` Pretty-print a predicate.\n", "* `:solve` Solve a predicate with the specified solver\n", "* `:table` Display an expression as a table.\n", "* `:time` Execute the given command and measure how long it takes to execute.\n", + "* `:type` Display the type of a formula.\n", "* `:version` Display version info about the ProB CLI and ProB 2\n" ], "text/plain": [ "Type a valid B expression, or one of the following commands:\n", "::load Load the machine source code from the body.\n", "::render Render some content with the specified MIME type.\n", - ":? Display help for a specific command, or general help about the REPL.\n", + ":assert Ensure that the predicate is true, and show an error otherwise.\n", ":browse Show information about the current state\n", ":constants Set up the current machine's constants with the specified predicate\n", ":eval Evaluate an expression.\n", @@ -48,13 +48,13 @@ ":groovy Evaluate the given Groovy expression.\n", ":help Display help for a specific command, or general help about the REPL.\n", ":init Initialise the current machine with the specified predicate\n", - ":initialise Initialise the current machine with the specified predicate\n", ":load Load the machine from the given path.\n", ":pref View or change the value of one or more preferences.\n", ":prettyprint Pretty-print a predicate.\n", ":solve Solve a predicate with the specified solver\n", ":table Display an expression as a table.\n", ":time Execute the given command and measure how long it takes to execute.\n", + ":type Display the type of a formula.\n", ":version Display version info about the ProB CLI and ProB 2\n" ] }, @@ -71,85 +71,23 @@ "cell_type": "code", "execution_count": 2, "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "Type a valid B expression, or one of the following commands:\n", - "\n", - "* `::load` Load the machine source code from the body.\n", - "* `::render` Render some content with the specified MIME type.\n", - "* `:?` Display help for a specific command, or general help about the REPL.\n", - "* `:browse` Show information about the current state\n", - "* `:constants` Set up the current machine's constants with the specified predicate\n", - "* `:eval` Evaluate an expression.\n", - "* `:exec` Execute an operation with the specified predicate, or by its ID\n", - "* `:groovy` Evaluate the given Groovy expression.\n", - "* `:help` Display help for a specific command, or general help about the REPL.\n", - "* `:init` Initialise the current machine with the specified predicate\n", - "* `:initialise` Initialise the current machine with the specified predicate\n", - "* `:load` Load the machine from the given path.\n", - "* `:pref` View or change the value of one or more preferences.\n", - "* `:prettyprint` Pretty-print a predicate.\n", - "* `:solve` Solve a predicate with the specified solver\n", - "* `:table` Display an expression as a table.\n", - "* `:time` Execute the given command and measure how long it takes to execute.\n", - "* `:version` Display version info about the ProB CLI and ProB 2\n" - ], - "text/plain": [ - "Type a valid B expression, or one of the following commands:\n", - "::load Load the machine source code from the body.\n", - "::render Render some content with the specified MIME type.\n", - ":? Display help for a specific command, or general help about the REPL.\n", - ":browse Show information about the current state\n", - ":constants Set up the current machine's constants with the specified predicate\n", - ":eval Evaluate an expression.\n", - ":exec Execute an operation with the specified predicate, or by its ID\n", - ":groovy Evaluate the given Groovy expression.\n", - ":help Display help for a specific command, or general help about the REPL.\n", - ":init Initialise the current machine with the specified predicate\n", - ":initialise Initialise the current machine with the specified predicate\n", - ":load Load the machine from the given path.\n", - ":pref View or change the value of one or more preferences.\n", - ":prettyprint Pretty-print a predicate.\n", - ":solve Solve a predicate with the specified solver\n", - ":table Display an expression as a table.\n", - ":time Execute the given command and measure how long it takes to execute.\n", - ":version Display version info about the ProB CLI and ProB 2\n" - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - ":?" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "```\n", - ":? [COMMAND]\n", ":help [COMMAND]\n", "```\n", "\n", "Display help for a specific command, or general help about the REPL." ], "text/plain": [ - ":? [COMMAND]\n", ":help [COMMAND]\n", "\n", "Display help for a specific command, or general help about the REPL." ] }, - "execution_count": 3, + "execution_count": 2, "metadata": {}, "output_type": "execute_result" } @@ -160,38 +98,7 @@ }, { "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "```\n", - ":? [COMMAND]\n", - ":help [COMMAND]\n", - "```\n", - "\n", - "Display help for a specific command, or general help about the REPL." - ], - "text/plain": [ - ":? [COMMAND]\n", - ":help [COMMAND]\n", - "\n", - "Display help for a specific command, or general help about the REPL." - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - ":? :?" - ] - }, - { - "cell_type": "code", - "execution_count": 5, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -209,7 +116,7 @@ "Load the machine from the given path." ] }, - "execution_count": 5, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -220,7 +127,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -244,7 +151,7 @@ "Load the machine source code from the body." ] }, - "execution_count": 6, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -262,27 +169,25 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "```\n", - ":? [COMMAND]\n", ":help [COMMAND]\n", "```\n", "\n", "Display help for a specific command, or general help about the REPL." ], "text/plain": [ - ":? [COMMAND]\n", ":help [COMMAND]\n", "\n", "Display help for a specific command, or general help about the REPL." ] }, - "execution_count": 7, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -293,38 +198,7 @@ }, { "cell_type": "code", - "execution_count": 8, - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "```\n", - ":? [COMMAND]\n", - ":help [COMMAND]\n", - "```\n", - "\n", - "Display help for a specific command, or general help about the REPL." - ], - "text/plain": [ - ":? [COMMAND]\n", - ":help [COMMAND]\n", - "\n", - "Display help for a specific command, or general help about the REPL." - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - ":help ?" - ] - }, - { - "cell_type": "code", - "execution_count": 9, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -342,7 +216,7 @@ "Load the machine from the given path." ] }, - "execution_count": 9, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -360,7 +234,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -385,7 +259,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -403,7 +277,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -427,8 +301,9 @@ "name": "prob2" }, "language_info": { + "codemirror_mode": "prob2_jupyter_repl", "file_extension": ".prob", - "mimetype": "text/x-prob", + "mimetype": "text/x-prob2-jupyter-repl", "name": "prob" } }, diff --git a/src/main/java/de/prob2/jupyter/ProBKernel.java b/src/main/java/de/prob2/jupyter/ProBKernel.java index b9422585d7d610489bec3910bc75eb45057a9ba4..7fa6e8510eaa546ddfb5763bac4f11a2b96b1010 100644 --- a/src/main/java/de/prob2/jupyter/ProBKernel.java +++ b/src/main/java/de/prob2/jupyter/ProBKernel.java @@ -135,9 +135,7 @@ public final class ProBKernel extends BaseKernel { this.animationSelector = animationSelector; this.commands = new HashMap<>(); - final Command help = injector.getInstance(HelpCommand.class); - this.commands.put(":?", help); - this.commands.put(":help", help); + this.commands.put(":help", injector.getInstance(HelpCommand.class)); this.commands.put(":version", injector.getInstance(VersionCommand.class)); this.commands.put(":eval", injector.getInstance(EvalCommand.class)); this.commands.put(":type", injector.getInstance(TypeCommand.class)); @@ -149,7 +147,6 @@ public final class ProBKernel extends BaseKernel { this.commands.put(":browse", injector.getInstance(BrowseCommand.class)); this.commands.put(":exec", injector.getInstance(ExecCommand.class)); this.commands.put(":constants", injector.getInstance(ConstantsCommand.class)); - this.commands.put(":initialise", injector.getInstance(InitialiseCommand.class)); this.commands.put(":init", injector.getInstance(InitialiseCommand.class)); this.commands.put(":assert", injector.getInstance(AssertCommand.class)); this.commands.put(":time", injector.getInstance(TimeCommand.class)); diff --git a/src/main/java/de/prob2/jupyter/commands/HelpCommand.java b/src/main/java/de/prob2/jupyter/commands/HelpCommand.java index 6b2fafaf18d98f015088ecb6adaade3eda55f004..61b27e75e121d0e52e28c1aa3cb1234a29ee35c6 100644 --- a/src/main/java/de/prob2/jupyter/commands/HelpCommand.java +++ b/src/main/java/de/prob2/jupyter/commands/HelpCommand.java @@ -22,7 +22,7 @@ public final class HelpCommand implements Command { @Override public @NotNull String getSyntax() { - return ":? [COMMAND]\n:help [COMMAND]"; + return ":help [COMMAND]"; } @Override diff --git a/src/main/java/de/prob2/jupyter/commands/InitialiseCommand.java b/src/main/java/de/prob2/jupyter/commands/InitialiseCommand.java index b2e94e5d05ac1862e7410e5c03e05b9910059192..c5e155978851cbdcec256023a2a267c0e33a194e 100644 --- a/src/main/java/de/prob2/jupyter/commands/InitialiseCommand.java +++ b/src/main/java/de/prob2/jupyter/commands/InitialiseCommand.java @@ -30,7 +30,7 @@ public final class InitialiseCommand implements Command { @Override public @NotNull String getSyntax() { - return ":initialise [PREDICATE]\n:init [PREDICATE]"; + return ":init [PREDICATE]"; } @Override