Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-6397

groovysh: prefix commands with ":" to avoid namespace overlap

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.2.0-rc-1
    • 2.3.0-beta-1
    • Groovysh

    Description

      Groovysh oofers several commands, as listed here:
      http://groovy.codehaus.org/Groovy+Shell#GroovyShell-RecognizedCommands

      The problem with those commands right now is that they overlap in namespace with variable/function names.

      Other similar REPLs have solved this by using command prefixes. E.g. scala:

      :cp
      :help

      Or ipython
      %alias:
      %autocall:

      The issue appears when trying to define variables that are already taken as command names:

      groovy:000> save = 3
      Command 'save' requires a single file argument

      Which is very annoying when copy/pasting code, and having to rename a variable.

      So I suggest adding a command prefix to groovysh for most commands (except maybe "import", such as a colon (like Scala for conformity), or '\' as used in groovysh already for shortcuts.

      Attachments

        Activity

          People

            Unassigned Unassigned
            tkruse Thibault Kruse
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: