doc/commands: term accept CmdEntityLink commands
authorAlexandre Terrasa <alexandre@moz-code.org>
Tue, 1 May 2018 19:33:56 +0000 (15:33 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Wed, 2 May 2018 23:03:34 +0000 (19:03 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/doc/term/term.nit

index a82d7b8..200d93f 100644 (file)
@@ -23,9 +23,8 @@ redef class CommandParser
                var cmd = self.parse(query)
                var error = self.error
 
-               # If not a command, try a comment query
-               if cmd == null and error isa CmdParserError then
-                       error = null
+               # Translate links to doc commands
+               if cmd isa CmdEntityLink then
                        cmd = new CmdComment(view, mentity_name = query)
                        var opts = new HashMap[String, String]
                        var status = cmd.parser_init(query, opts)
@@ -36,7 +35,8 @@ redef class CommandParser
                        error.print_message(no_color)
                        print ""
                end
-               cmd.as(not null).execute(no_color)
+               if cmd == null then return
+               cmd.execute(no_color)
        end
 end