From 3cd3865b509e928e17d8a5a58841a1996532390b Mon Sep 17 00:00:00 2001
From: dgelessus <dgelessus@users.noreply.github.com>
Date: Thu, 21 Jun 2018 12:33:39 +0200
Subject: [PATCH] Remove alternate names for :help and :init

It's cleaner to have only one name for each command.
---
 notebooks/tests/animate.ipynb                 |   2 -
 notebooks/tests/help.ipynb                    | 163 ++----------------
 .../java/de/prob2/jupyter/ProBKernel.java     |   5 +-
 .../prob2/jupyter/commands/HelpCommand.java   |   2 +-
 .../jupyter/commands/InitialiseCommand.java   |   2 +-
 5 files changed, 22 insertions(+), 152 deletions(-)

diff --git a/notebooks/tests/animate.ipynb b/notebooks/tests/animate.ipynb
index 30c76d6..bc367a0 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 60ae957..d601de4 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 b942258..7fa6e85 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 6b2fafa..61b27e7 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 b2e94e5..c5e1559 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
-- 
GitLab